You need to sign in to do that
Don't have an account?
Word attachments in visualforce email templates
Hi,
I am trying to create a word file attachment in the visualforce email template. The code I use inside the template is as follows:
<messaging:attachment filename="{!relatedTo.name}.doc" >
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word">
<head>
<meta name="contentType"
<meta name="ProgId" content="Word.Document" />
<meta name="Generator" content="Microsoft Word 12" />
<meta name="Originator" content="Microsoft Word 12" />
</head>
<body>
<div>
<table>
<apex:repeat var="cx" value="{!relatedTo.ChildRelationName__r}">
<tr>
<td> <apex:outputField value="{!cx.field1__c}"/> </td>
<td> <apex:outputField value="{!cx.field2__c}"/> </td>
<td> <apex:outputField value="{!cx.field3__c}"/> </td>
</tr>
</apex:repeat>
</table>
</div>
</body>
</html>
</messaging:attachment>
But the attached word file always shows error when I try to open it.
We could set the attribute contentType="application/msword" for apex:page, but I don't seem to find any such attribute for messagin:attachment.
I just wanted to know if anyone has done this? Any help is appreciated!!
Thanks!!