Export to Excel - wrong extention (.csv).
Export to Excel - wrong extention (.csv).
Corran
Posts: 10Questions: 0Answers: 0
The new TableTools 2.0 is great but I discovered a strange bug.
When you select Export to Excel (even in the example on this very site: http://www.datatables.net/release-datatables/extras/TableTools/index.html) the filename given ends with .csv (in the above case it's TableTools example.csv).
Renaming it manually to .xls works fine but this will be beyond the skillset of many people unfortunately.
The downloaded file is different from the CSV option though, the file size and content are not the same.
When you select Export to Excel (even in the example on this very site: http://www.datatables.net/release-datatables/extras/TableTools/index.html) the filename given ends with .csv (in the above case it's TableTools example.csv).
Renaming it manually to .xls works fine but this will be beyond the skillset of many people unfortunately.
The downloaded file is different from the CSV option though, the file size and content are not the same.
This discussion has been closed.
Replies
there is this part
[code]
"xls": {
"sAction": "flash_save",
"sCharSet": "utf16le",
"bBomInc": true,
"sFileName": "*.csv",
"sFieldBoundary": "",
"sFieldSeperator": "\t",
"sNewLine": "auto",
"sTitle": "",
"sToolTip": "",
"sButtonClass": "DTTT_button_xls",
"sButtonClassHover": "DTTT_button_xls_hover",
"sButtonText": "Excel",
"mColumns": "all",
"bHeader": true,
"bFooter": true,
"fnMouseover": null,
"fnMouseout": null,
"fnClick": function( nButton, oConfig, flash ) {
this.fnSetText( flash, this.fnGetTableData(oConfig) );
},
"fnSelect": null,
"fnComplete": null,
"fnInit": null
},
...
[/code]
so basically you can do it like this (i tried and it works)
[code]
"oTableTools": {
"sSwfPath": "/flash/copy_cvs_xls_pdf.swf",
"aButtons": [
{
"sExtends": "xls",
"sButtonText": "<?php echo $this->translate('xls tabella')?>",
"sFileName": "*.xls"
},
....
[/code]
that is you use "sFileName": "*.xls"
I'm currently disabling export to "excel" and letting Excel users just open the CSV. But if there's an actual format difference between the two, I might re-enable it and use the above suggestion.
It is perfectly possible to write xls files, I just need to get the time to read, understand and reproduce the format - it is on the to-do list :-)
Regards,
Allan
From one Allan to another Allan :P
Allan Chappell
Allan
Also a quick more picture filled guide
http://dl.dropbox.com/u/7177934/Ebooks/Open%2BXML%2BExplained.pdf
and lastly, an xlsx file that you can have fun with... just use winrar, or your favorite archive utility to unzip it... it's just a standard zip.
http://dl.dropbox.com/u/7177934/tracking_report_476.xlsx
I hope this helps
Allan
Good luck, and you're welcome. Thank you for providing such a cool product. Many a site would be bland and less user friendly if it wasn't for you.