You need to sign in to do that
Don't have an account?
Vivo
Downloading a CSV through visualforce page
Hi,
I have a CSV generating page set up right now, that I run from another page when they click the generate button. It is opening up the page and starting the download, but the blank page that it downloads from is being opened and stays open. Is there a way to make the page automatically close itself once the download begins?
<apex:page controller="csvController" cache="true" contentType="text/csv#filename.csv" language="en-US"> {!headers} </apex:page>
Hi,
I am calling it via outputlink:
<apex:outputLink value="{!placetogo}" style="text-decoration:none;" styleClass="btn" target="_blank">Create</apex:outputLink>
Where placetogo is the URL for the page:
placetogo=URL.getSalesforceBaseUrl().toExternalForm() + '/apex/generatespreadsheet?id='+sheet.Scenario__c;
Thanks.
<apex:commandLink value="My Link" action="{!generateCSV}"/>
public Pagereference generateCSV(){
return new Pagereference(placetogo);
}
Hi,
I tried this and it seems to just change the current page to the blank one and start the download..
Thanks,
Vivek
This will call a method in controller that will bring back to the original page.
Hm I tried to do this but everything I write in the <script></script> tags on this page gets written onto the CSV instead of acting as a function