762
Views
29
Comments
Download widget corrupts Excel file

Hello everyone,

I encountered an obstacle with Download widget (I assume). Msg that appears when I'm trying to open downloaded Excel file - 'The file is corrupt and cannot be opened'.

My goal is to export Record List to Excel file using RecordListToExcel widget. I'm sure that the provided data (Record List) are correct, I can see them in debugger. 'Record List To Excel' also works cause I've converted Record List To Excel then backwards Excel To Record List to validate my assumption. And I was right, Excel operations widgets works as they should. I assume that the problem is caused by Download widget but I have no idea how I can check that or fix it. I tried a lot of different mime-types and file extensions. Nothing helped. Google'd everywhere and didn't found any solution. Unfortunately I can't provide OML file cause it contains sensitive data.

Anybody have any idea how to solve it?

Appreciate any feedback and thank you in advance for your help.

Best regards,

Jakub


download_widget.png
2020-03-05 14-29-02
José Costa

Hi Jakub,

The Download statement should work with the mime type you're using. Can you build a very simple app just to download something in excel format? To see if it works. If it works, try to see what are the differences between the two apps.

Cheers,

José

2016-04-21 20-09-55
J.
 
MVP

Hi,


Well, you could create a simple oml, with some dummy data to test it and share it with us.

- did you test with a simple name (so no round brackets)?

- which excel is it? it might need xls instead of xlsx.


UserImage.jpg
Jakub Bujak

Jose - I did that and everything there works fine (see attached ExcelTest.oml).

J. - yes, I've tested it with simplest filename's that are possible like - tmp.

Kilian - yes, the file has content cause it size is 22kb. Yes, the method is Submit.

ExcelTest.oml
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Jakub,

Did you check whether the Excel file has any content? The "file is corrupt and cannot be opened" also happens when the file is 0 bytes.

Secondly, did you use Submit for the download button (not Ajax Submit!)? If not, change the button's Method Property to "Submit".

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Jakub,

Another question - do you save it with the right extension? I recall the "content corrupt" also appearing if an xlsx (which is what OutSystems produces) is saved with an "xls" extension. Could you post the corrupt file here?

UserImage.jpg
Jakub Bujak

Kilian - I've tried all available extensions, xlsx, xls, xlsm, etc..

I'm out of any ideas so I've decided to ask you guys for help :)

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Well, like I said, please attach the corrupt file here. Maybe we can analyse it to see what kind of corruption you have.

UserImage.jpg
Jakub Bujak

I think the problem is caused by Download widget or some things in the module can be corrupted.

tmp.xlsx
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Jakub,

Just to get the terminology straight, Download is not a Widget but a Statement. Widgets are placed on the Screen (like Buttons, or the Upload Widget), Statements are used in your logic.

That said, I looked at the XLSX file, and though it appears valid at first glance, it's not even a valid ZIP file (which all XLSX and other Microsoft documents like DOCX actually are). So it's indeed corrupted in some non-obvious way (it seems to have a valid ZIP header).

I'm at loss what is going on hear, I've never heard of downloads getting corrupted like this, so I think we can rule out a bug in the Platform. But unfortunately, I don't know how to troubleshoot this.

UserImage.jpg
Jakub Bujak

My bad with terminology, thanks a lot for clarifying and dedicated time :)

Greetings,

Jakub

2016-04-21 20-09-55
J.
 
MVP

Something is strange, did it quick test on my PE and everything is peachy.


can you tell us your version of the platform.

did you update to the latest systems-components etc. ?


UserImage.jpg
Jakub Bujak

Service Studio Version 10.0.825.0. 

System-Components Version 10.0.708.0

2026-01-26 10-25-31
Lennart Kraak
Champion

Hi Jakub,

You said "And I was right, Excel operations widgets works as they should."
Do you use other actions/extension to edit the Excel, like Advanced Excel?

UserImage.jpg
Jakub Bujak

Lennart - no, I do not use anything else than default Outsystems Excel statements..

2025-09-25 22-50-38
Hanno

Jakub, your content type is the issue. If you use "application/vnd.ms-excel" it works with your test OML supplied.


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hanno,

I don't think that could be it. application/vnd.ms-excel is the content type for the old "XLS" Excel files, not the newer XLSX ones. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" is indeed the right content type for XLSX, though the standard "application/octet-stream" should work fine too.

2025-09-25 22-50-38
Hanno

Killian, you are correct. I tested with application/vnd.ms-excel and it does work.

Funny thing, if I publish the provided sample OML to my personal environment, it works as provided with the "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" content type.

I made double sure of this by deleting the OML and then re-uploading it.

"application/octet-stream" has worked fine for all implementations that I have been part of the last 2 years and I believe that is the default for the download action?

UserImage.jpg
Jakub Bujak

Hanno - I've tested all possible combinations of mime-type & it didn't solve the problem. Yes it works with provided oml, but the space in which it needs to be implemented is a part of a bigger system form which I can't provide oml.

2025-09-25 22-50-38
Hanno

I understand that you cannot provide the OML, but can you perhaps send a screenshot of the flow in the action where you are creating and downloading the excel file?

2025-09-25 22-50-38
Hanno

Jakub, how is your environment hosted? OutSystems cloud or self-hosted/on-premise?

UserImage.jpg
Jakub Bujak

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Ok, at this point (nothing weird in the image) I'd say contact OutSystems support. This might well be a bug in the Platform. In the meantime (while awaiting their answer), try to export a single Attribute that's sure to not cause any problems (e.g. a simple Integer or Text Attribute), and see if the file is still corrupt.

UserImage.jpg
Jakub Bujak

Environment is hosted on Outsystems cloud

2025-09-25 22-50-38
Hanno

I found some posts alluding to IIS compression being the culprit, but as Kilian said, rather open a support ticket with OutSystems support.

2023-05-25 02-32-50
Leandro Daniel Lemos Murta

Hello everyone, we are having an similar issue with the ".pptx" files, so i am wondering if this problem with the corrupted excel files had any solution since then...

what was the provided solution?

thanks in advance!

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Leandro,

Is it just Power Point files, or other types of binary files as well? Is it with every browser, or just with e.g. IE or Chrome? What Platform version are you using?

2023-05-25 02-32-50
Leandro Daniel Lemos Murta

Kilian Hekhuis wrote:

Hi Leandro,

Is it just Power Point files, or other types of binary files as well? Is it with every browser, or just with e.g. IE or Chrome? What Platform version are you using?

Hello Killian,

tested and happening with Chrome and firefox... we are using the 10.0.1003.0...

So far happened with Power Point .pptx and Excel .xlsx

2019-01-03 21-16-54
Nicolaas Kuit

I've been able to export corrupted Excel files in OutSystems when I called HTTPRequestHandler.AddMetaTag in the System Event 'On Begin Web Request'.

Check if you're inadvertently adding anything to the response.

2022-04-29 05-12-00
Rijan Lexter Libunao

Hi Everyone , I am having the same issue with corrupted file (.xls/.xlsx).
Do you guys found the solution about this?

what was the solution then ?
thank you very much!!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.