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

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é

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.


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".

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.

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?

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 :)

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

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

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.

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

Greetings,

Jakub

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. ?


Service Studio Version 10.0.825.0. 

System-Components Version 10.0.708.0

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?

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

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


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.

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?

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.

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?

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

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.

Environment is hosted on Outsystems cloud

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