Dear Sir / Madam,
We use Aspose.word to parse word templates using the mailmerge function with a dataset. Some parts of the template should be hidden or visible depending on dataset values. We solved this by using the mailmerge event.
On this event we check if a part of the document should be visible. If it should be hidden, we find it by bookmark name and set the bookmark text to string.empty. This works if we use it on a clean part (dont try to do this on a single table row because it will crash, parent and child node conflict).
Now we have a new problem. Setting a bookmark that contains a table to string.empty works perfectly. But changing some values within the bookmark text that also contains table characters corrupts the bookmark completely.
You can try setting a .bookmark[mybookmark].text = .bookmark[mybookmark].text; where the bookmark contains a table. While you think this should not even change the value, this will result in garbage text where the table definition should be. Also if you do change any character of the text string the table definition is gone.
Is there any work around for this?
Dear Sir / Madam,
One must be careful trying to change complex document content such as table using bookmarks. Note that our code is not yet as sophisticated as MS Word object model and note that bookmark.text = bookmark.text is only setting text of the bookmark, but it does not carry all the other structures and formatting that might be part of the text. For example, when you apply this to a bookmark that contains a table, the text, including table characters is set, but table structure and formatting information is all lost.
Let me know more, send some samples to show what exactly do you want to achieve. We might be able to work out a solution or simplify some things.
We need functionallity to insert a document into a merge field. The document to be inserted contains other data than just text (like tables). The insertion does not work. Aspose can work with this by adding sections, but i cannot add sections from a merge field position, we also can not find out how to do this on the specialfieldmerge event.
we would be helped when we could insert sections from a merge field, so the inserted section keeps its tables etc. correctly displayed.
Well, this is actually a very good idea, to be able to insert whole document or a section at some position inside a document, not only at the section end. I think this idea is very useful so I add it to our top priority list immediately. Cannot give an exact delivery timeframe, hopefully 1-2 weeks.