Free Support Forum - aspose.com

Newbie: how to insert a word document into another one

Hi, I got a problem when I use aspose.word. I want to insert a word document to another one in the middle of my report. I found a way from wiki, but they merged at the end of the first document and I want to do this at the postition of my bookmark . How can I do this?

One more question, did aspose.word support to insert a *.XLS(Mircosoft excel) or *.MPP(Microsoft Project) document into a word document? If can, how?

Best regards

Hi,

Have you read this topic:

http://www.aspose.com/Wiki/default.aspx/Aspose.Words/ExSectionCombineDocuments.html

?

Pay attention to the section called Inserting the content of one document to another at different locations. There you can see a method that allows to insert a document at any document node including bookmarks. In your case you should probably use a BookmarkStart node:

BookmarkStart bookmarkStart = dstDoc.Range.Bookmarks["PlaceToInsert"].BookmarkStart;

InsertDocument(bookmarkStart, srcDoc);

With respect to your another question - the answer is unfortunately negative. Yet Aspose.Words preserves and allows to access different OLE objects including those representing Microsoft Excel or Project documents, it's impossible to insert them directly. Did you mean any other way of insertion?

Thank you for your speedy reply. I got all what I need.