Embedding docs into templatized word doc

I’ve been tasked with getting PDF/Word/Excel documents loaded via .NET and then displayed in a templateized report. The documents would need to be embedded (fully readaable) in the final report. How do I go about doing this?

Recently I posted about embedding images, and that is working. I assumed this would be similar but haven’t had any luck.

Thanks

Hi Frank,

Thanks for your inquiry. I think, the following workflow will help you to meet this requirement:

  1. Convert PDF document to images using Aspose.Pdf for .NET
  2. Convert Excel file to images using Aspose.Cells for .NET
  3. Convert above images to Word documents using Aspose.Words for .NET
  4. Append above Word documents into a single document using Aspose.Words for .NET.

I hope, this helps.

Best regards,

Thank you for your reply. I think this is close to what I need but there is an issue. We are using template based word documents, so we can’t just ‘append’ documents to it. They inserted content goes in very specific places.
I was able to get pdf and excel to work by making them images and then using textbox in word template they display fine.
Using the same technique, how to get a word document into images, similar to pdf and excel, so I can then bring them into my template document.
Thanks

Hi Frank,

Thanks for your inquiry. You can convert your document to Images using Aspose.Words. Please see the following code to generate images per each page in your Word document:

Document document = new Document(@"C:\temp\In.docx");

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Jpeg);
options.PageCount = 1;

// Save each page of the document as Jpeg.
for (int i = 0; i < document.PageCount; i++)
{
    options.PageIndex = i;
    document.Save(string.Format(@"C:\temp\out_{0}.jpg", i), options);
}

If you just want to convert whole Word document into a single TIFF, please use the following code:

Document document = new Document(@"C:\temp\In.docx");
document.Save(@"C:\temp\out.tiff");

I hope, this helps.

Best regards,