Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
Saving Workbook in Excel 2007 Format produces Document
posted

My application allows exporting database tables to Excel. As I switched to new XLSX format I have noticed that Excel 2007 always requires a file repair before file can be opened.
The problem occurs even with very simple data in the test code below: 
 

WorkbooktestWorkbook = new Workbook();
testWorkbook.SetCurrentFormat(
WorkbookFormat.Excel2007);
Worksheet worksheet = testWorkbook.Worksheets.Add("Test Sheet");
worksheet.Rows[0].Cells[0].Value =
"Test value";
testWorkbook.Save(targetFilePath);

If I try to open generated file the first time with Excel 2007, it claims the format is invalid and makes a repair with following repair log summary. (Unfortunately I have a German version of Excel, so the summary text was in German. I have translated it myself, so it might be different from the English version. )

<repairedParts summary="Following repairing has been done:_x000d__x000a__x000d__x000a_">
   <repairedPart>Repaired part: /xl/worksheets/sheet1.xml-Part with XML error. Error loading data. Line 11, Column 71.</repairedPart>
</repairedParts>

By the way, the generated file can't be opened with Infragistics either:

        testWorkbook = Workbook.Load(targetFilePath);  

causes System.ArgumentOutOfRangeException is thrown at Infragistics.Excel.WorksheetCollection.get_Item(Int32 index)

If  Excel97To2003 workbook format is used, correct xls file is generated and can be opened with Workbook.Load. 

Am I doing something wrong or is it a known issue?
If it is a known issue, is any hotfix planned? (December Hotfix for Infragistics 8.3 did not help)

Thanks in advance.

DFE

Parents Reply Children