[OfficeUtils] Excel download not possible

[OfficeUtils] Excel download not possible

  
Forge Component
(24)
Published on 2017-04-26 by Elena Novozhilova
24 votes
Published on 2017-04-26 by Elena Novozhilova

Hi there,

I'm creating an xlsx as seen in the screenshot. When I feed the output binary to an email attachment, it is sent just fine. However, when I try to download it, it doesn't respond at all. When I debug, it just executes through the Download widget and thats it, the download prompt is never seen on screen. I've used this download widget before with pdf and it worked just fine.

The FileName is "Report.xls". (xlsx also did not work) SaveToDisk is "Yes". I've tried the following mime-types: 

"application/force-download"
"application/octet-stream"
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"



I cannot find any other alternatives. Could you please help me? Thanks a lot.

Platform Version 10.0.408.0

Solution

That is the method of your button calling the action? 


Use the Download Tool to send a file to a user. This is an element that ends the action flow, so it is not possible to define new actions after it. If the Ajax Submit method is used to trigger the download, the download will not work.


https://success.outsystems.com/Documentation/10/Reference/Logic/Implementing_Logic/Web_Logic_Tools/Download

Solution

Oh, I thought I could make it work in the same action with an IF statement whether to download the excel or mail it, but you're right; the download doesn't work (and gives no warnings!) when the submit button is ajax AND there is an IF statement whether to use download widget or not. I should have thought in OutSystems-style. I changed the structure, made the button non-ajax submit and now it downloads.

Thanks a lot for the heads-up.

Regards.