jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Getting "file format and extension don't match" when exporting xls file
Tagged: angular grid xls xlsx, data grid
This topic contains 11 replies, has 5 voices, and was last updated by ivanpeevski 3 years, 4 months ago.
-
Author
-
November 1, 2018 at 4:20 pm Getting "file format and extension don't match" when exporting xls file #102594
We’re using the Angular version of the grid, and are exporting our file to Excel using the following call:
this.myGrid.exportdata(‘xls’, ‘FileName’, true, null, false, ‘http://localhost/PHPExport/dataexport.php’);
However, when we try to open the file in Excel we get this message:
“The file format and extension of ‘FileName.xls’ don’t match. Ths file could be corrupted or unsafe. Unless you trust its source, don’t open it. Do you want to open it anyway?”
Is there any way to stop this happening? We are able to open the file, but it obviously doesn’t look good for our users when they see this.
As a further point, is it possible to tweak the dataexport.php file to allow us to save .xlsx files instead of xls?
November 2, 2018 at 1:01 pm Getting "file format and extension don't match" when exporting xls file #102609Hi Duncan,
Thanks for writing.
We are aware of the message and we have description about it in the Grid’s API. More information about this is available on: https://blogs.msdn.microsoft.com/vsofficedeveloper/2008/03/11/excel-2007-extension-warning-on-opening-excel-workbook-from-a-web-site-2/.
At present, we cannot stop this message to appear. We are planning to make changes in the Data Export in the January 2019 release regarding this matter.
Regards,
PeterFebruary 1, 2019 at 8:12 pm Getting "file format and extension don't match" when exporting xls file #103815Hi jQWidgets Team,
Was looking at the January 2019 release notes for a fix to this issue but could not find it.
Is the fix posponed for a later release? If so, when do you plan to release it?
Thanks,
February 2, 2019 at 4:31 pm Getting "file format and extension don't match" when exporting xls file #103816Hi fperez,
In general, this is not an issue. This is ‘xls’ export and the message is officially documented by Microsoft. We still do not have ‘xlsx’ data export. It is in development, but is not ready.
Best Regards,
Peter StoevjQWidgets Team
https://www.jqwidgets.comNovember 22, 2021 at 9:00 am Getting "file format and extension don't match" when exporting xls file #121110Hi jQWidgets Team,
any news on this one?
customer is getting bummed out by the message.with friendly regards
November 22, 2021 at 1:58 pm Getting "file format and extension don't match" when exporting xls file #121111Hi Kamp,
The xlsx format is now supported either by using the exportdata method or exportview, which generates the exported file on the client-side, without requiring a server.
Please have a look at the demo here: https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/dataexportview.htm?lightIf you have any other questions, please do not hesitate to contact us again.
Best Regards,
Ivan Peevski
jQWidgets team
https://www.jqwidgets.comNovember 24, 2021 at 12:08 pm Getting "file format and extension don't match" when exporting xls file #121120Hi jQWidgets team,
sounds great, but unfortunately it doesn’t work for me.In jqxgrid.export.js -> _exportData(…) ->
var dataExporter = new $.jqx.dataAdapter.DataExporter( { exportHeader: dataExport.header } );
fails with: TypeError: $.jqx.dataAdapter.DataExporter is not a constructorI’m using jQWidgets v13.1.0
Not too sure if this is a problem on my endwfr,
KampNovember 24, 2021 at 4:25 pm Getting "file format and extension don't match" when exporting xls file #121122Hi Kamp,
Thank you for reporting the problem. We are aware of the issue and we are working on fixing it as soon as possible.
The problem comes from the jqxGrid not importing some of the required scripts.
Until the fix becomes available, you can use theexportview
function by manually importing the missing scripts:
Inside the index.html file of the project, you need to import the following scripts:<script type="text/javascript" src="https://www.jqwidgets.com/public/jqwidgets/jqxexport.js" ></script> <!-- JSZip --> <script type="text/javascript" src="https://www.jqwidgets.com/jquery-widgets-demo/scripts/jszip.min.js" ></script> <!-- pdfmake --> <script type="text/javascript" src="https://www.jqwidgets.com/jquery-widgets-demo/scripts/pdfmake.min.js" ></script> <script type="text/javascript" src="https://www.jqwidgets.com/jquery-widgets-demo/scripts/vfs_fonts.js" ></script>
Then inside the app.module.ts, you need to import the following script:
import 'jqwidgets-scripts/jqwidgets/jqxexport';
Now you can use the exportview function in your application:
this.myGrid.exportview('xlsx', 'jqxGrid');
You can have a look at a working demo here: https://stackblitz.com/edit/github-a5f9we?file=src/app/app.component.ts
Apologies for the inconvenience. We will release a permanent fix as soon as possible!
If you have any other questions, please do not hesitate to contact us again.
Best Regards,
Ivan Peevski
jQWidgets team
https://www.jqwidgets.comNovember 25, 2021 at 9:56 am Getting "file format and extension don't match" when exporting xls file #121123Hi Ivan Peevski,
I’ve got it working thanks to you, but I still have an issue:I’m setting styles (fore-/background color) via cellclassname.
This works fine when exporting via exportdata (the resulting xls file will be colored correctly).
When exporting via exportview the xlsx file seems damaged.
Opening that file Excel starts the Repair dialogue, which subsequently removes the styling.Repaired Records: Cell information from /xl/worksheets/sheet1.xml part
with friendly regards,
KampNovember 26, 2021 at 4:26 pm Getting "file format and extension don't match" when exporting xls file #121134Hello Kamp,
Unfortunately this functionality is not yet available for the xlsx file format, however it is something we may consider adding in the future.
In the meantime, you may also consider usingexportdata('html')
which also preserves the CSS rules of the GridIf you have any other questions, please do not hesitate to contact us again.
Best Regards,
Ivan Peevski
jQWidgets team
https://www.jqwidgets.comNovember 30, 2021 at 8:07 am Getting "file format and extension don't match" when exporting xls file #121147Hi Ivan Peevski,
I see. For now, could you make it so there won’t be an error message when opening a .xlsx file that has been exported with cellclassname styling?
I’m very much looking forward to you implementing cell styles to xlsx export though, as the new method is way more convenient.with friendly regards,
KampDecember 1, 2021 at 9:57 pm Getting "file format and extension don't match" when exporting xls file #121156Hi Kamp,
Unfortunately, I am not able to reproduce your issue. In the demo below, I have set text color and background color to the first column and I don’t receive any errors in Excel 2019.
https://stackblitz.com/edit/github-a5f9we?file=src%2Fapp%2Fapp.component.ts
Please let me know if you receive an error when exporting the demo grid from the above demo.If the problem continues, you can also share your Excel version and the css you are applying, so that we can help you fix the problem.
Best Regards,
Ivan Peevski
jQWidgets team
https://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.