How to convert Excel 2007 Open XML (*.xlsx) to legacy format files (*.xls, ex. Excel 97) using Softartisans ExcelWriter

StackOverflow https://stackoverflow.com/questions/19637266

  •  01-07-2022
  •  | 
  •  

Question

Is there a way to convert between the new Excel 2007/2010/2013 (.xlsx) file format and the old pre-2007 (.xls) format using the Softartisans ExcelWriter .NET library.

This code:

ExcelApplication application = new ExcelApplication();
Workbook workbook = application.Open("NewFormatFile.xlsx");
application.Save(workbook, "OldFormatFile.xls");

gives following error:

This workbook is a workbook without macros and must be saved with the .xlsx extension, but filename was OldFormatFile.xls
Était-ce utile?

La solution

Unfortunately, you cannot convert xlsx to xls with ExcelApplication or ExcelTemplate.

This is noted in the Template object Open() method documentation, and the same applies for the application object:

http://wiki.softartisans.com/display/EW8/ExcelTemplate.Open(System.IO.Stream)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top