We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Unable to Save Workbook

I'm evaluating XlsIO for our company and am using version 4.3.0.30. I'm getting the following error when saving a worksheet.

System.ApplicationException: Error in the application.
at Syncfusion.XlsIO.Implementation.Collections.WorkbookNamesCollection.GetNewIndexes(SortedListEx list)
at Syncfusion.XlsIO.Implementation.Collections.WorkbookNamesCollection.Serialize(OffsetArrayList records)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.Serialize(OffsetArrayList records, ExcelSaveType saveType)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(String FileName, ExcelSaveType saveType)
at SFTest1.SFTest1.btnTestXLSSave_Click(Object sender, EventArgs e) in c:\kla\excel\sftest1\sftest1.cs:line 126


The code I'm using is:

private void btnTestXLSSave_Click(object sender, System.EventArgs e) {
Cursor.Current = Cursors.WaitCursor;
try {
IWorkbook workBook = null;
try {
ExcelUtils.ThrowNotSavedOnDestroy = false;
workBook = ExcelUtils.Open( @"C:\annablek\_scratch\MOF Transition Template.xls" );

foreach( IWorksheet sheet in workBook.Worksheets ) {
Log( String.Format( "{0}: {1}", sheet.Index, sheet.Name) );
}
Log( "----------" );
IWorksheet sht1 = workBook.Worksheets["ACS"];
workBook.Worksheets.Remove( sht1 );

foreach( IWorksheet sheet in workBook.Worksheets ) {
Log( String.Format( "{0}: {1}", sheet.Index, sheet.Name) );
}
workBook.SaveAs( @"c:\annablek\_scratch\MOF1.xls", ExcelSaveType.SaveAsXLS );
} finally {
workBook.Close( false );
workBook = null;
}
} catch( Exception ex ) {
Log( ex );
} finally {
Cursor.Current = Cursors.Default;
}
}

The workBook.SaveAs statement is line 126. The Excel file is 8055KB in size and contains 88 worksheets. The code is removing worksheet 48. Am I doing something wrong? Thanks.

3 Replies

MW Melba Winshia Syncfusion Team November 3, 2006 11:29 AM UTC

Hi Ken,

Thank you for your interest in Essential XlsIO.

I am afraid. I was unable to reproduce the issue. I used the following test sample to test your issue.

Sample :
SavingWorkbook.zip


Could you please provide me your sample xls file in which you are able to reproduce the issue? It will help me in investigating further on this issue.

Thanks,
Melba



KE Ken November 6, 2006 11:33 AM UTC

Melba,

I was able to successfully open, delete a worksheet, and save when I used the Sample.xls you sent. Attached is the spreadsheet that is causing the error. Thanks.

Ken

> Hi Ken,

Thank you for your interest in Essential XlsIO.

I am afraid. I was unable to reproduce the issue. I used the following test sample to test your issue.

Sample :
SavingWorkbook.zip


Could you please provide me your sample xls file in which you are able to reproduce the issue? It will help me in investigating further on this issue.

Thanks,
Melba



MOF Transition Template.zip


MW Melba Winshia Syncfusion Team November 6, 2006 12:22 PM UTC

Hi Ken,

I was able to reproduce the problem. I have created a bug report regarding this issue; you can track the status of this issue from the following link:

http://www.syncfusion.com/support/issues/xlsio/Default.aspx?ToDo=view&questId=2976

We will try to address this issue as soon as possible. Sorry for the inconvenience.

Thanks,
Melba

Loader.
Live Chat Icon For mobile
Up arrow icon