field evaluation in RTF files
-
Hi, I wanted to use the RTF/CRichEditCtrl as a kind of report system, where the reports are generated from templates of rtf files. Consider a simple application, that needs to fill out a predefined form with some application dependant values. A first simple solution would be to search and replace Tags within the RTF file with the computed values. A better solution would be to use the field tag from the RTF specification directly. For example the author field from a word document would look like: {\field{\*\fldinst { AUTHOR \\* MERGEFORMAT }}{\fldrslt {Dirk}}} where fldinst is the specific field instruction and fldrslt is the latest evaluated result. Unhappily the CRichEditCtrl does not evaluate internal fields (like author) either, and I couldn't find any Interface in the ITextDocument specification to access the fields of the document. Does anybody know how to reevaluate the contents of fields programmatically? Something like a callback function with the fied instruction (fldinst) and the return value is the evaluated result? Another possibility would be to reparse the complete document again and aply the evaluated values into the result field (fldrslt) and then feed the document back to the Ctrl. Any ideas / code? Thanks Dirk