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
  •  | 
  •  

문제

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
도움이 되었습니까?

해결책

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)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top