You need to sign in to do that
Don't have an account?

VF as Word doc - but also reloads the browser...
Hello. I have VF page which allows the User to select some records. Then the User presses a button - which calls a controller method that returns a PageReference to a VF page with the contentType attribute set to a Word doc type. Works perfectly - except that in addition to launching Word it also tries to load the page in the browser...so the browser is blank (Word doc looks fine). What do i have to do to make the browser stay on the same page? (i thought setting the contentType would have prevented the browser change, but apparently i'm mistaken there.
thanks
chris
hi chris,
try cache = true.
<apex:page cache = true>
already have that. my page node is:
apex:page showHeader="False"
controller="ActivityHistoryNotesController"
language="en" cache="true"
contentType="application/msword; charset=Windows-1252"
I guess adding "pageRef.setRedirect(false);"should do it right..
Like:
PageReference pageRef = new PageReference('/apex/MyVFPage');
pageRef.setRedirect(false);
return pageRef;
Sumit
Hello.
Thanks for your reply. I had tried that as well, but the results are the same. When the button is clicked, the URL changes to the new page (https://c.cs11.visual.force.com/apex/ActivityHistoryList?id=001A000000AWO6i) - the browser renders (blank) and the Word doc opens...
Any ideas?
Thanks
Chris
Looks like i figured it out, although i'm not entirely sure what it means...
In my original setup, i was on one VF page...the button called a separate VF page (different controller, etc).
i decided to consolidate all of the logic into one VF page and one controller. Now it works as expected. I'm guessing if in my original setup - if i had the same controller but two pages, it would have worked properly...
Thanks again for your responses.
Chris
I am sorry, I presumed that you have 2 pages with 1 controller..the solution which I suggested will 100% work in that situation..
Also, I really don't think that you can control this if you use different controller.
Thanks
Sumit