Error when trying to save spreadsheet

When I try to save the spreadsheet attached I am getting the following error:

An unhandled exception of type 'System.ArithmeticException' occurred in system.drawing.dll

Additional information: Overflow or underflow in the arithmetic operation.

If I do not update the SI Work sheet then I can save the workbook and I do not get the error, however once I add a row to this and attempt to save then the error occurs.

Thanks,

Richard.

Hi Richard,

Thanks for considering Aspose.

I use your template file without any problem / error which you are mentioning and the output file is fine (attached).

Following is my testing code:

Workbook workbook = new Workbook();
workbook.Open("d:\\test\\summary.xls");
Worksheet worksheet = workbook.Worksheets[1];
Cells cells = worksheet.Cells;
cells.InsertRows(1,4,true);

cells["A2"].PutValue("ABC Pubshr.");
cells["B2"].PutValue("UK");
cells["C2"].PutValue("1");
cells["D2"].PutValue("5");
cells["E2"].PutValue(112);
cells["F2"].PutValue(4);
cells["G2"].PutValue(100);
cells["H2"].PutValue(200);
cells["I2"].PutValue(.84);

cells["A3"].PutValue("ABC Pubshr.");
cells["B3"].PutValue("UK");
cells["C3"].PutValue("21");
cells["D3"].PutValue("15");
cells["E3"].PutValue(132);
cells["F3"].PutValue(3);
cells["G3"].PutValue(200);
cells["H3"].PutValue(100);
cells["I3"].PutValue(.92);

cells["A4"].PutValue("CBA Pubshr.");
cells["B4"].PutValue("USA");
cells["C4"].PutValue("1");
cells["D4"].PutValue("5");
cells["E4"].PutValue(112);
cells["F4"].PutValue(3);
cells["G4"].PutValue(100);
cells["H4"].PutValue(200);
cells["I4"].PutValue(.87);

cells["A5"].PutValue("CBA Pubshr.");
cells["B5"].PutValue("USA");
cells["C5"].PutValue("1");
cells["D5"].PutValue("5");
cells["E5"].PutValue(112);
cells["F5"].PutValue(2);
cells["G5"].PutValue(100);
cells["H5"].PutValue(200);
cells["I5"].PutValue(.88);


workbook.Save("d:\\test\\summary2.xls");

Which version of Aspose.Cells you are using? Please try the attched version.

Thank you.

Hi Amjad,

Thanks for the reponse.

I decided to comment out most of my coding so that all I did was update the spreadsheet as you have done and found that it did work OK. I then tracked back commenting back in code until Aspose gave me the warning.

The background of what I am doing is converting a Cobol database that I can access through ODBC to be a SQL database. I using Aspose to query the data from either due to the vast speed improvement over using Excel.

What I have found is that when I query the SQL database the saving of the workbook works fine, however the error saving the workbook only arises when I query the Cobol database. I have changed the query to return no records and update the worksheet as you have coded and the save still does not work. It seems to be directly related to querying the Cobol database.

I know this is a difficult one as I am integrating with a thrid party product for the Cobol connectivity, but I would appreciate any help you could give me.

Thanks,

Richard.

Hi Richard,

How do you query Cobol database? how do you import data to the spreadsheet using Aspose.Cells APIs? Which classes with their methods do you use of Aspose.Cells library for the task. Could you provide us some related code snippet.

We will also look into the issue and get back to you soon.

Thank you.