Computers/Language 2012. 8. 29. 11:15

C#에서 xls를 xlsx로 저장하면 읽을수 없다. 물론 확장자를 xls로 변경하면 읽어지긴 하는데 불편


Excel 2007 format 으로 저장


저장방법

http://stackoverflow.com/questions/9769703/exporting-to-xlsx-using-microsoft-office-interop-excel-saveas-error

This is how you save the relevant file as a Excel12 (.xlsx) file... It is not as you would intuitively think i.e. using Excel.XlFileFormat.xlExcel12 but Excel.XlFileFormat.xlOpenXMLWorkbook. The actual C# command was

excelWorkbook.SaveAs(strFullFilePathNoExt, Excel.XlFileFormat.xlOpenXMLWorkbook, Missing.Value,
   
Missing.Value, false, false, Excel.XlSaveAsAccessMode.xlNoChange,
   
Excel.XlSaveConflictResolution.xlUserResolution, true,
   
Missing.Value, Missing.Value, Missing.Value);

I hope this helps someone else in the future.

posted by 털보네i
: