function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RajusRajus 

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 .

Thanks,
Raj.

Vamsi KrishnaVamsi Krishna
Raj,
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">

<html>
Keep your existing content here..
</html>

</apex:page>
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-header-margin:.0in;
    mso-footer-margin: 0.125in;
    mso-paper-source:0;
    mso-footer:f1;
border:solid windowtext 1.5pt;
padding:9.0pt 17.0pt 27.0pt 17.0pt;   
    }

div.WordSection1
    {page:WordSection1;}
    p.MsoFooter, li.MsoFooter, div.MsoFooter {
    mso-pagination:widow-orphan;
    }

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

•Hospital
•Clinic
•Nursing Home
•CRO

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"/>
    <body>
    <h2>Business Requirement</h2>
    
    <table width="100%" border="1" cellspacing="0" cellpadding="0" >
            <tr>
                <th>BR#</th>
                <th>Requirement Summary</th>
                <th>Use Case</th>
            </tr>
            <tr>
                <td>{!CMAX__Business_Requirement__c.Name}</td>
                <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>
            </tr>
    </table>
</body>
     </html>
  
</apex:page>



Thanks,
Rajesh.