Pages

Tuesday, July 26, 2011

Visualforce: Render Page as .Doc

It's amazingly easy to create a VF page and have it open as a Word document. I've used this a handful of times when my VF page is a form and I want to offer a printable copy.

VF:
<apex:page contentType="application/msword">

However, this post isn't about that. It's about breaking up your content within that .Doc. Sometimes, you need different data in different sections of separate pages. Easy breezy, just include this every time you want a page break in your .doc file.

VF:
<br clear="all" style="page-break-before:always" />