This project has moved. For the latest updates, please go here.

Insert Converted Text at Bookmark

Feb 25, 2016 at 3:29 PM
Great Library by the way, works a treat :-)

I have one question...I need to insert the converted HTML at a particular location within the Word Document.

The background: I have a word document, which I am inserting data from a database into the document, most of which is plain text and is straight forward. One data field is HTML and I would like to insert this into the word document I it's converted form using the library. I can insert the data at he end but I cannot see how to have it inserted at a particular location.

is this possible?

Many thanks

PW
Coordinator
Feb 27, 2016 at 12:46 PM
Hello phantoweb,


There are 2 methods in the API to parse the html: Parse() and ParseHtml().

ParseHtml() will insert all the converted chunks into the word. This is the preferred version.
Parse() will returns you the list of Paragraphs that you can insert at the position you want.

Beware that the latter may require some "fixes" in the final word ; the link order is important for example.
So in your case, you will have to rely on the 2nd method and test against it.
If it doesn't work, you can still use ParseHtml() in a new empty document, then merge your original one with the "empty".

http://blogs.msdn.com/b/brian_jones/archive/2008/12/08/the-easy-way-to-assemble-multiple-word-documents.aspx



Olivier