We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Load XLTX template and save as XSLX is broken


seems that loading an “xltx” template file and saving as “xslx” file is broken. See attached sample: it contains a xltx and a xlt template file. The sample has three buttons which load the templates and save as corresponding xls/xslx file. For xlt/xls it works. For xltx/xslx there is an error when opening the resulting file in Excel, see “excel_error.png” (it is a german screenshot, the error message is “fileformat and extension do not match”).

I followed the steps at <a href="https://forum.aspose.com/t/87136, but both suggested approaches (create workbook from template and save as xslx OR create copy of workbook) don’t work.

I use 8.7.0

Best regards

Wolfgang Knauf
Hirschbiegel+Grundstein GmbH

Hi Wolfgang,

Thank you for sharing the samples.

I have evaluated the presented scenario and I believe the said issue “file format & extension do not match” is caused due to the reason that you are specifying incorrect extension while saving the Workbook on disc. In your code, you are specifying the file names with XSLX extension which is incorrect. Please change it to XLSX then Excel will not complain about the extension. Please find the attachment for resultant spreadsheets generated with your application while referencing Aspose.Cells for .NET 8.7.0.

Damn, you are right!

Recently, I had made the same error in another situation and had tried to open this file with excel - this had associated the file with excel, and thus I saw an excel icon now. But now I removed all associations - it will not happen again ;-).




Good to know that your issue is sorted out now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.