Open egeriis opened 6 years ago
@PixelCrux Can you try this standalone.js build? https://gist.github.com/egeriis/017981f86d55c33b7f7ee4c641d974c0
That build causes the browser to open the file in the same frame and display it like this:
It does that for my method of exporting CSV's too.
I can confirm this issue and also that the provided jist package isn't working.
Slightly offtopic as this is a very new library it would be helpful to create some (one) jsfiddle (or similar service) URLs to see this library working and be able to do some simple tests. It should be added to the front page. Would be a good basic for those issues to discuss on too.
@PixelCrux Unfortunately the image you added is blank for me 🙁 Can you describe what you're seeing, and on which device?
@simonberger I think that's a good idea. We didn't have a standalone build to use in a jsfiddle until this week, so it wouldn't have been possible before. I will encourage you do make this jsfiddle and submit a PR added a reference in what you think is the appropriate place. Since it's your idea, I think you have a better understanding of what the best approach is 🙂
Whoops. I have no idea what happened there. Let me try the screenshot again:
This happens on iPhone and iPad using the latest iOS version.
It seems you do not set the mime type option to jszip file generation which itself sets the contenttype to the blob. The default type is application/zip so safari handles it correctly.
EDIT: Fixes it on iOS. See included standalone.js http://jsfiddle.net/ffru199v/
@simonberger In the build I linked (gist), I do the same thing as in your build, as far as I can tell? It also seems to work for @PixelCrux, although it's not downloading the file. Are you experiencing the same thing?
Yes it opens inside the document for me as well.
There is a pull request that fix this, but in the mean time I solved it by adding, mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'}
to the file standalone.js
From
... t.generateAsync({ type: "blob"}) ....
To
... t.generateAsync({ type: "blob", mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'}) ....
@ichbinedgar Yes this is the solution of egeriis and my gist as well. I don't know why this hasn't been fixed in the code yet.
I wouldn't focus too much on the fact the documents partly be rendered in browser. While I notice this in jsfiddle, Plunker for example opens it in a new window where you are able to open/share it to other apps. It seems to be a problematic jsfiddle functionality in my case at least. iOS shouldn't be the main targeting platform to view xlsx documents anyway?!
@simonberger It should work cross-browser, including iOS. There might be a way to force download, that may not be necessary to give a good user experience though.
I'll get this fix out in the official channel asap.
@egeriis Looking at the issues and commits in the FileSaver package there seems to be a nonstop fight to support the client side blob download of every new browser version. mobile systems are special in trying to preview/open the file in an app anyway.
My point mainly was it seems to work correctly (or at least good enough) in iOS with this mime type fix.
@egeriis any chance to have this fix in master? There is also problem with the name of the generated file on iOS - looks like the file name parameter is ignored by any browser on iOS. Any idea how to fix this?
@jk171505 Top of mind, I don't know what would cause the file name issue. We have a fix in a PR, I'll merge it today 🙂
@jk171505 Above mentioned is merged and published as 1.5.0, fyi
Has this been fixed? I still see the issue on iOS (WKWebView), (using zipcelx 1.6.2). When I try to download, I see the document in the browser frame as mentioned above by @PixelCrux .
As reported in #19, iOS doesn't properly recognize the generated file as an xlsx file, but rather thinks it's a zip file.