+ Start a Discussion
RajusRajus 

Unexpected characters in word format.

Hi All,
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 any one 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/rtf;charset=ISO-8859-1#Word_Document.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> 
    <h3>This section of the User Requirement Specification contains all of the business requirements of the system.
    These requirements are written at a level of detail sufficient to enable designers to design a system that will
    satisfy those requirements and testers to test that the system satisfies those requirements.
    (Static from one of the field from Release Plan)</h3>
    <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>
Pablo_RoldanPablo_Roldan
Try to use the following contentType:
contentType="application/msWord"
Instead of:
contentType="application/rtf;charset=ISO-8859-1#Word_Document.doc"

If this works, please click on "Best answer" to know that it's solved.

Thanks,
Pablo
RajusRajus
Hi Pablo,

I tried with contentType="application/msWord", but still i am getting the same.Can you suggest some other way to resolve it.


Thanks,
Rajesh.
Pablo_RoldanPablo_Roldan
Try the following code:

VFP
<apex:page standardcontroller="Business_Requirement__c" contentType="application/msWord#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>
<h3>This section of the User Requirement Specification contains all of the business requirements of the system.
    These requirements are written at a level of detail sufficient to enable designers to design a system that will
    satisfy those requirements and testers to test that the system satisfies those requirements.
    (Static from one of the field from Release Plan)</h3>
    <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>


APEX CLASS
public class GenerateReport_BR{
    public String getPrintView()
    {
        return
        '<!--[if gte mso 9]>' +
            '<xml>' +
            '<w:WordDocument>' +
            '<w:View>Print</w:View>' +
            '<w:Zoom>100</w:Zoom>' +
            '<w:DoNotOptimizeForBrowser/>' +
            '</w:WordDocument>' +
            '</xml>' +
            '<![endif]>';
        }
    }

Thanks,
Pablo
RajusRajus
Hi Pablo,
Thanks for your reply,
I am using the same code for printView getter method.Still i am getting the same result.I think some thing needs to be changed at charset property of ContentTYpe in apex:page tag.But i dont know what are all the possible charsets we can specify.
Can you please suggest on this.

Note:Those unexpected characters coming only when the field type is richtext area and having the bullet points and tab space after the bullet point.

Thanks,
Rajesh.

Pablo_RoldanPablo_Roldan
Hi Rajus,

I thought that I have answered, sorry about that.
To include rich text in word files you will need the following contentType:
contentType="application/ms-word; charset=Windows-1252#msword.doc"

Thanks,
Pablo
RajusRajus
I am getting the same result even after trying with contentType="application/ms-word; charset=Windows-1252#msword.doc".
Any other workarounds please..


Thanks,
Raj.