We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error "Row number or column number cannot be zero" while calling WebWorksheets.SaveToExcelFile

Hello,

I am working with Aspose.Cell.GridWeb. I am trying to save the worksheets to an excel file. But it is throwing an exception. The exception details are as below:

Message "Row number or column number cannot be zero"

Stacktrace at ௑.Merge(Int32 firstRow, Int32 firstColumn, Int32 rowNumber, Int32 columnNumber)
at Ӡ.(Object ܰ, WebWorksheets ੶, Boolean ੷, ༐ ੸)
at Aspose.Cells.GridWeb.Data.WebWorksheets.SaveToExcelFile(String targetFile)

The code snippet is as follows:

System.IO.MemoryStream mstream = new System.IO.MemoryStream();

GridWeb1.WebWorksheets.SaveToExcelFile(mstream);

mstream.Flush();

System.IO.FileStream fout = new System.IO.FileStream("d:\\out.xls", System.IO.FileMode.Create);

fout.Write(mstream.GetBuffer(), 0, (int)mstream.Length);

fout.Close();

Please help.

Thanks.

Hi,

I have tested your code, it works fine without any issue/error.

Please try the attached latest version/fix.

If you still find the issue kindly create a sample project and post it here to reproduce the issue, we will check it soon.

Thank you.

I guess I found the exact issue. My GridWeb has few 'merged' cells. When I tried calling the SaveToExcelFile(...) method again after removing the 'Merge' code, it worked.

Is there a way to handle it?

Thanks.

Hi,

Please try my attached version (Aspose.Cells.GridWeb v2.0.3.2012). I have tested your issue with merged range of cells, it works fine.

If you still find the issue, kindly create a simple project, post it here to show the issue. We will check it soon.

Thank you.