Hello, I read your article on how to save Excel worksheets as MHT files. Can I insert that MHT file into a Word document with Aspose Words - rather than inserting HTML- in order to effectively include the Excel page(s) into Word? If so, would I use the insertHTML() method or another method?
Thank you.
Hi,
You 'd better ask Aspose.Words team for your task as we can only help regarding Aspose.Cells product.
For your convenience, I am moving this thread to Aspose.Words forum, one of our Aspose.Words team’s technical support staff member will help you soon.
Thank you.
Oh, very true.
I originally had an Excel question also, but it turned out to be a Words-only question. Thanks for moving it.
Hi Chris,
Thanks for your query. Yes, you can insert .mht file into MS Word documents at any place. You can also load .mht file into Aspose.Words.Document object. Please see the code below:
Document doc = new Document(MYDir + "in.mht");
doc.save(MYDir + "AsposeOut.docx", SaveFormat.DOCX);
Please read following documentation links for your kind reference.
https://reference.aspose.com/words/java/com.aspose.words/loadformat
https://reference.aspose.com/words/java/com.aspose.words/saveformat
https://docs.aspose.com/words/java/insert-and-append-documents/
You can insert .mht file contents in MS Word documents by using following code snippet.
Document doc = new Document(MYDir + "in.docx");
Document docMHT = new Document(MYDir + "in.mht");
// Insert MHT file contents after first Paragaph of in.docx
insertDocument(doc.getFirstSection().getBody().getFirstParagraph(), docMHT);
doc.save(MYDir + "AsposeOut.docx", SaveFormat.DOCX);
Please let us know if you have any more queries.