Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excel files exported but do not show associated with Excel in Firefox #500

Closed
desuraghu opened this issue Jun 17, 2020 · 6 comments · Fixed by #501
Closed

Excel files exported but do not show associated with Excel in Firefox #500

desuraghu opened this issue Jun 17, 2020 · 6 comments · Fixed by #501
Labels

Comments

@desuraghu
Copy link

I'm submitting a Bug report

Your Environment

Software Version(s)
Angular 7.2.4
Angular-Slickgrid 2.17.11
TypeScript 3.2

Describe the Bug

Exporting data through excel export service. In chrome download is working fine.
But in firefox the file is not associated with Excel, instead it has been marked as zip.

Steps to Reproduce

ExcelExport in Firefox

Expected Behavior

exported file should be associated with Excel

Possible Solution

During blob creation, we need to specify the mime type of the file. So that browser will detect the type and it will show the correct associated application.

@close-issue-app
Copy link

This issue was automatically closed by our bot because it does not meet our issue template requirements. Please fill in the questions/sections required in the issue template before submitting a new issue. Thank you.

@ghiscoding
Copy link
Owner

ghiscoding commented Jun 17, 2020

I don't typically deal with issues closed by the bot but I see this as a valid issue, just make sure to fill in all required section of the issue template next time to avoid having the bot auto-closing the issue, it's mainly in place to avoid seeing poorly detailed issues.

As for the issue with Firefox, I can reproduce but I'm not sure how to fix it since the Blob is not created in my lib but rather by the ExcelBuilder external lib. So that would need more investigation,

@ghiscoding ghiscoding reopened this Jun 17, 2020
@ghiscoding ghiscoding added the bug label Jun 17, 2020
@desuraghu
Copy link
Author

Thanks for looking into it. I was not sure, which data i have missed it. Will try to follow the guidelines next time.
How about creating a new blob with the returned object. I am sure this is not a good idea to clone the blob.

@ghiscoding
Copy link
Owner

ghiscoding commented Jun 17, 2020

The template required fields all have the <!-- REQUIRED ...> and I think you missed Current Behavior, it's ok not a big deal, like I said it's mostly in place to close issues that just start with "Please help..." without providing much info and I got tired of those and added the auto-close bot and since then I get much better detailed issues ;)

As for the issue itself, I found how to pass the mime type to the external lib in the 2nd argument for the options, the following seems to work

const mimeType = this._fileFormat === FileType.xls ? 'application/vnd.ms-excel' : 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet ';
ExcelBuilder.Builder.createFile(this._workbook, { type: 'blob', mimeType });

I think that is the correct type for both xls and xlsx but perhaps you could validate that, I used the following, in my Firefox it now shows this popup and it now opens correctly

image

@desuraghu
Copy link
Author

Yes mime type is correct for both xls and xlsx.

ghiscoding added a commit that referenced this issue Jun 18, 2020
…#501)

Co-authored-by: Ghislain Beaulac <ghislain.beaulac@se.com>
@ghiscoding
Copy link
Owner

This is now fixed in latest version 2.19.x.

Please upvote ⭐ if you haven't already.
Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants