After update setFileFormat() no longer works

Hello,

we use Aspose.Cells for Java. Since we updated from 20.1 to 22.3.0 the setFileFormat() no longer works. No matter what I set, it always recognises it as Excel format (FileFormatType.XLSX).

in = getClass().getResourceAsStream(EXCEL_TEMPLATE);

m_Workbook = new Workbook(in);

WorksheetCollection sheets = m_Workbook.getWorksheets();

if (m_Output.endsWith(".xlsx")) {
m_Workbook.setFileFormat(FileFormatType.XLSX);
} else if (m_Output.endsWith(".xls")) {
m_Workbook.setFileFormat(FileFormatType.EXCEL_97_TO_2003);
} else if (m_Output.endsWith(".pdf")) {
m_Workbook.setFileFormat(FileFormatType.PDF);
}

@Helga,

Could you please share your sample files (you may zip the archive prior attaching here) to evaluate your issue precisely on our end. Also, how do you detect/recognize the generated file by Aspose.Cells, please share your sample code (runnable) for reference?

Hello,

I can’t show you the source-code because it is a customer project.

The part m_Workbook.setFileFormat(FileFormatType.PDF) is executed but don’t have impact.

@Helga,

Please note, if you specified the file format as PDF, we have not made any changes for the Workbook. Obviously, one Workbook object model cannot be changed to PDF data model for sure. Our workbook and relevant data models are only for spreadsheet file formats. Some other file formats, such as, PDF, image, HTML are only used for rendering purpose. The backend data model is always spreadsheet file format.

Also, we have tested to reset one workbook’s file format between FileFormatType.EXCEL_97_TO_2003 and FileFormatType.XLSX, there is no problem what so ever. The file format can be changed successfully.