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
Ashok N 8Ashok N 8 

Merge VF Page rendered as Word doc with another Word doc[attachment/Static Resource]

Hello All,

I am looking at getting help for merging two word documents. Below is the smaple code i have tried and not working. Please help me with sample code.
1. The first doc one is a VF page rendered as word doc.
2. The second doc is an attchment/Static Resource. 

Sample Code
1. VF Page
<apex:page renderAs="" contentType="application/vnd.msword#TC.doc" controller="TCCont">
    <apex:outputText value="{!textFromSomeUniqueName}">
    </apex:outputText> 
</apex:page>

2. Controller

public class TCCont {
    
    public Attachment textFromSomeUniqueName {
        get {
            Attachment att = [Select Body from Attachment where ParentId='a089000001ZtT8m' ];
            return att;
        }
    }