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

Cannot create a compound file

I open a template excel file, add some data to it and save the file. I get "cannot create compound file" error.

Here's the code:

protected IWorkbook _Book;
ExcelEngine excelEngine = new ExcelEngine();
excelEngine.ThrowNotSavedOnDestroy = false;
IApplication excel = excelEngine.Excel;
excel.SheetsInNewWorkbook = 5;
_Book = excel.Workbooks.Open("Template Dir/Filename");

string filePath = "Some file path";
_Book.SaveAs(filePath+_FileName, ExcelSaveType.SaveAsXLS);
_Book.Close();
excelEngine.Dispose();


2 Replies

EM Emperor November 30, 2007 03:32 PM UTC

Please help...

>I open a template excel file, add some data to it and save the file. I get "cannot create compound file" error.

Here's the code:

protected IWorkbook _Book;
ExcelEngine excelEngine = new ExcelEngine();
excelEngine.ThrowNotSavedOnDestroy = false;
IApplication excel = excelEngine.Excel;
excel.SheetsInNewWorkbook = 5;
_Book = excel.Workbooks.Open("Template Dir/Filename");

string filePath = "Some file path";
_Book.SaveAs(filePath+_FileName, ExcelSaveType.SaveAsXLS);
_Book.Close();
excelEngine.Dispose();





MW Melba Winshia Syncfusion Team December 3, 2007 06:20 AM UTC

Hi Emperor,

Thank you for your interest in Syncfusion Products.

Normally this exception occurs if you don't have permission to write the file to the specific location on disk. Could you please check that if you have permission to write the file to disk?

Please let me know if the issue still exists after giving permission to write the file.

Thanks,
Melba



Loader.
Live Chat Icon For mobile
Up arrow icon