+ Start a Discussion

Invalid footer when using contentType="application/msword" in Salesforce.

Hi All,

I am getting some invalid images at the end of the MS-Word doc like below.

Invalid footer
I am using apex:page tag like below.
<apex:page standardcontroller="Account" contentType="application/msword; charset=Windows-1252" extensions="GenerateReport_BR" language="en" cache="true">

Can any one please let me know where i am doing mistake .


Vamsi KrishnaVamsi Krishna
if you wrap your visualforce content inside a html tag, it will get rid of the unwanted calendar control.

<apex:page standardcontroller="Account" contentType="application/msword; charset=Windows-1252" extensions="GenerateReport_BR" language="en" cache="true">

Keep your existing content here..

Matt WhalleyMatt Whalley
you have to use Documents using the full Url, like https://c.domain.content.force.com/servlet/servlet.ImageServer?id={docIdHere}&oid={orgIdHere}

It is also advisable to keep your content as said above in the <html> tags, plus stick it all in a div called WordSection1, like <div class="WordSection1"> when you have a class defined in the style tags:

@page WordSection1
    {size:8.5in 11.0in;
    margin:0.125in 0.25in;
    mso-footer-margin: 0.125in;
border:solid windowtext 1.5pt;
padding:9.0pt 17.0pt 27.0pt 17.0pt;   

    p.MsoFooter, li.MsoFooter, div.MsoFooter {

There's a lot of tricks to know when exporting to word.
Hi Matt,
I am getting some un expected characters in word document some thing like below.

•Nursing Home

I tried all possible ways to get rid of this issue but no use.Can you please help me out to sort out this issue.
Follwoing is my visualforce code:
<apex:page standardcontroller="Business_Requirement__c" standardStylesheets="false" showheader="false" contentType="application/ms-word; charset=Windows-1252#msword.doc" extensions="GenerateReport_BR" cache="true">
    <html xmlns:w="urn:schemas-microsoft-com:office:word">
    <apex:outputText value="{!PrintView}" escape="false"/>
    <h2>Business Requirement</h2>
    <table width="100%" border="1" cellspacing="0" cellpadding="0" >
                <th>Requirement Summary</th>
                <th>Use Case</th>
                <td><apex:outputtext escape="false" value="{!CMAX__Business_Requirement__c.CMAX__Business_Requirements_Summary__c}"/></td>
                <td><apex:outputtext escape="false" value="{!CMAX__Business_Requirement__c.CMAX__Use_Case__c}"/></td>