We are trying to build a RTF-document dynamically by having a RTF-template containing DOCVARIABLEs and MERGEFIELDs and binding it to/insert values from, a data-source. Our biggest problem is how to handle insertion of table data. If we where to use the approach in the Master-detail demo, we would need additional RTF-templates for each table, and we would like to avoid that. Is it possible to some way define the master-detail templates inside a RTF-template (and extract them in some way)?
The only other solution we see is to build the tables in code-behind and insert them, the big downside being that we can't style the tables.
Generally, you should be able to define any number of master and/or detail templates within one RTF document. After that utilize the SubDocument.GetRtfText Method to extract a certain template. Note that in this scenario you need to know in which DocumentRange this template is located. I hope you will find this information helpful.
Thanks for the response. We'll be looking at using SubDocument.GetRtfText to get the master and detail templates. The next problem comes with identifying the parts (documentranges) that contains a master/detail template. Is there any way to put a RTF-template in a identifiable part of the RTF document? Looking at the document model a document contains "sections" (and pages?), is it possible to insert RTF-text into a seperate part - and if so, is it possible to give this part some kind of identifier/name so it can be found?
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.