We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to render the document within document in mail merge

How to render the document(docx,pdf,.jpg) within document(i.e we need to write the content of docx,pdf & jpg file inside the another document) using mail merge concept.

Hi Suresh,


Thanks for your inquiry. Please refer to the following section of documentation:
How to Execute Mail Merge

Secondly, you can implement IFieldMergingCallback interface and in the IFieldMergingCallback.FieldMerging method insert embedded OLE objects (PDF/Excel etc) in Microsoft Word document. Please see the following examples:

Insert embedded Excel 97-2003 document as iconic OLE object from stream using predefined image:

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);<o:p></o:p>

Stream memoryStream = File.OpenRead(MyDir + “Book1.xls”);<o:p></o:p>

Shape oleObject = builder.InsertOleObject(memoryStream, “Excel.Sheet.8”, true, null);<o:p></o:p>

doc.Save(MyDir + @“out.docx”);

Insert linked Word document from file as normal OLE object using custom presentation image

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);<o:p></o:p>

Image image = Image.FromFile(MyDir + “Aspose.Words.png”);<o:p></o:p>

Shape oleObject = builder.InsertOleObject(MyDir + “Doc1.docx”, true, false, image);<o:p></o:p>

doc.Save(MyDir + @“out.docx”);


You can also convert PDF to Word format using Aspose.Pdf for .NET API and then append it at the end of main Word document. Please refer to the following article:

Joining and Appending Documents

Hope, this helps.

Best regards,