saving to xls
saving to xls
whiterabbit
Posts: 5Questions: 0Answers: 0
Hi,
this tabletools is great!
i have a question about the excel export: the filename can be set in the javascript and this filename then appears in the flash file save dialogue. however if the user changes the filename in the dialogue but doesnt put the .xls at the end then it will be saved with no extension. since the typical end user doesnt know about file extensions, is there a way that the extension can automatically be added to the end of the filename after it has been changed in the dialogue. would this be a change to the flash?
thanks
this tabletools is great!
i have a question about the excel export: the filename can be set in the javascript and this filename then appears in the flash file save dialogue. however if the user changes the filename in the dialogue but doesnt put the .xls at the end then it will be saved with no extension. since the typical end user doesnt know about file extensions, is there a way that the extension can automatically be added to the end of the filename after it has been changed in the dialogue. would this be a change to the flash?
thanks
This discussion has been closed.
Replies
Allan
Is there anyway of fixing this bug manually in code?
something like this in pseudo code:
[code]
if(fileName.hasNoExtension) {
fileName + ".csv";
}
[/code]
thanks
Allan
[quote]whiterabbit said: however if the user changes the filename in the dialogue but doesnt put the .xls at the end then it will be saved with no extension.[/quote]
And there isn't a solution for this problem?
When the dialog pops up, the filename is easily overwritten, because it is selected.
I don't think Flash is responsible for this behaviour. I see it as a shortcoming in the .swf code.
The code is not "monkey-proof" at this time, and needs to be to be appropiate for different kinds of end-users.
I don't think Flash is responsible for this behaviour[/quote]
I don't see any options in the FileReference documentation which allows this behaviour to be altered. If anyone with better eyes than me can see what is needed, the input would be very welcome! http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6
Allan
I presume the copy_cvs_xls.swf is written by you?
Allan
http://bugs.adobe.com/jira/browse/FP-2014
http://bugs.adobe.com/jira/browse/FP-5654
...
But still, I think you should implement a workaround (e.g. add a property with a default extension to use when the file has no given extension).
Or at least give a warning about the file not having an extension (=worst solution).
Since the bug is not new, a lot of users will have the problem.
fileRef.save (.....
or is that what makes the file dialogue appear?
was thinking if it runs afterwards the filename could be checked and if there is no extension one can be added eg all excel would be xls, csv would be csv, pdf would be pdf etc
@whiterabbit: The .save() method is what makes the dialogue box appear with the file name that you want given to it (but again the user can override that if they want).
Allan
Datatables itself is all written in javascript. Is it because of the support to pdf output?
Allan
xls:{sAction:"flash_save",sCharSet:"utf16le",bBomInc:true,sFileName:"*.csv"
and changed it to:
xls:{sAction:"flash_save",sCharSet:"utf16le",bBomInc:true,sFileName:"*.xls"
Now, when the dialog pops up, the filename has the .xls extension. You're still going to get an error message when opening it in Excel, and that is simply due to the fact of its encoding.