I have a web application which uses _webout as the ods destination and the procs return an xlsx file. I have the following application headers:
data _null_; rc = stpsrv_header('Content-type','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); rc = stpsrv_header('Content-disposition','attachment; filename=SomeReport.xlsx'); run;
When I call the stored proc from Edge, what happens is that the file download dialogue will appear like this:
However what I'd like is for the browser to download the file automatically using the flyout menu like this:
Through research, it may appear that the header's are incorrect and/or the stored proc is not returning the (recognizable) binary content of the xlsx file. Is this true? The file I'm getting is an excel file. I open it and it works fine. Where in the stored proc would I ensure the binary content is valid and recognizable as an xlsx? is it something I set in the SP targets wizard?
I've ruled out the java script in the webpage code as I can run the hyperlink of the stored process directly in my browser without javascript to test reports and it results in the same behavior.
I would think that is browser behavior, so you'd have to see how Edge decides what to do with a file. From this page, it looks like users can configure their browser download options:
https://onlinecomputertips.com/support-categories/software/edge-download-options/
For downloading Excel files, I use:
rc = stpsrv_header('Content-type','application/vnd.ms-excel');
you might try that and see if it makes Edge handle it differently.
When I use that an Edge, I get a little download popup:
Note your first picture says it's from internet explorer, not Edge.
I would think that is browser behavior, so you'd have to see how Edge decides what to do with a file. From this page, it looks like users can configure their browser download options:
https://onlinecomputertips.com/support-categories/software/edge-download-options/
For downloading Excel files, I use:
rc = stpsrv_header('Content-type','application/vnd.ms-excel');
you might try that and see if it makes Edge handle it differently.
When I use that an Edge, I get a little download popup:
Note your first picture says it's from internet explorer, not Edge.
Wow that's weird. I am using edge, but for some reason the popup is from IE. I didn't notice that.
Turned out that both content type headers work in Chrome - I get the flyout menu downloaded as an excel file. but not Edge. Perhaps the Edge I'm working with is trash.
Marking solved as you're right; it's simply browser behavior.
Keep in mind that modern Edge uses the Chromium engine so same as Chrome. That may/may not be relevant but, im general, Chrome and Edge should work mostly the same. Same extensions work in both.
If you have an ancient version of Edge, that would be an issue. Check file associations as well. Remove IE if possible. That should be doable depending on your version of Windows.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.