Page 1 of 1
How to insert automatic page number code into saved RTF
Posted: Wed Mar 10, 2010 5:59 pm
by allanj42
When saving my document to RTF (using SaveRTF) how do I insert an RTF code to produce automatic page numbering? E.g. is there a code like {\pagenum} that I can insert into my RichTextEdit document before calling SaveRTF ? What other options or conditions need to be set for this to work?
Thanks,
Jeff Allan
Posted: Wed Mar 10, 2010 6:30 pm
by Sergey Tkachenko
A page numbering field is not implemented yet, planned for future.
If you need to save page numbers in a header or footer of RTF file, you have 2 options:
1) If you want to insert a simple page number, you can use OnSaveRTFExtra event to save header and footer. The code for page number is {\field{\*\fldinst PAGE}{\fldrslt 1}}, the example is here:
http://www.trichview.com/forums/viewtopic.php?t=64 (the first post)
2) If you want to create a complex header or footer in separate editors (or if you use ScaleRichView where header and footer can be edited directly), you need to insert RTF code {\field{\*\fldinst PAGE}{\fldrslt 1}} in the editor. This topic shows two ways how to do it:
http://www.trichview.com/forums/viewtopic.php?t=2742
In TSRichViewEdit, header and footer are saved automatically.
In TRichViewEdit, assign header and footer using rve.RTFReadProperties.SetHeader and .SetFooter, and include rvrtfSaveHeaderFooter in rve.RTFOptions.
Thanks
Posted: Mon Mar 15, 2010 7:08 pm
by allanj42
Thank you Sergey for your prompt and thorough answer.
I used the rvteoRTFCode solution.
I have now purchased a developer license for RT, largely because of the support you offer through this forum.
Jeff Allan
WellSight Systems