You need to sign in to do that
Don't have an account?
vbnm
render VF page as word document
Hi,
I have requirement like, I need to render a visual force as Word Document format with Password protected.
Right now in visual force, we are having attribute in page like 'renderas='PDF''. In the same we have to display VF page in Word document format with password protected.
Is it possible to do this? Please let me know is there any alternative solution for this requirement?
Hi Vbnm;
You can get a Word output by adding contentType attribute in to the <apex: page tag.
But I don't know about password protection.
<apex: page contentType="application/msWord">
All Answers
Hi Vbnm;
You can get a Word output by adding contentType attribute in to the <apex: page tag.
But I don't know about password protection.
<apex: page contentType="application/msWord">
Just a tip when doing contentType=application/msword. To get the document to open in word when you are viewing salesforce in Internet Explorer I've found you also need to add cache=true, otherwise it just hangs and word never opens. So it would be:
<apex: page contentType="application/msWord" cache="true">
I can add footer/header and page count in PDF, but when I output to word, those are lost.
So how to keep those in word?
CTU007,
Have a look at this, Turn VF Page into a Word doc and see if it helps explain it.
Thanks, BWags, I tried but it only displays footer on one(the last) page, do I need to put the footer div code on every page?
CTU007,
You only need to put the footer div code on the last page, making sure to set the style to "mso-element:footer". Then just use the CSS as described in the post I linked to.
By doing this when the page opens in Word, it "should" add the footer to the bottom of every page. Hope it helps, although I know from working with Salesforce/Word that it can be a real pain to get everything working properly.
Thanks for the reply, I checked and found out some "" are displayed as ? and that cause the problem.
Now I corrected it, and the footer is actually displaying on top of my pages as header, and there is not page # there.
I will play with it to find out why.
I finally get it to work... the footer div was missing the id "f1" ....
And I added one header as well...
Thanks, this will be veryful for my users to generate NDAs since mail merge is not working with office 2010.
No problem! Glad I could help and I'm glad you were able to get it working.
Could someone write up a definitive version of this with a full Visualforce page code sample and submit it to the Force.com Cookbook? http://developer.force.com/cookbook - Let's bake it!
CTU007
Please send me code to add header to all word document pages using Visual force.
I tried but i am gettig header in only single (first page).