How to insert automatic page number code into saved RTF

General TRichView support forum. Please post your questions here
Post Reply
allanj42
Posts: 10
Joined: Mon Mar 02, 2009 11:56 pm
Location: Canada

How to insert automatic page number code into saved RTF

Post 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
Sergey Tkachenko
Site Admin
Posts: 17520
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
allanj42
Posts: 10
Joined: Mon Mar 02, 2009 11:56 pm
Location: Canada

Thanks

Post by allanj42 »

Thank you Sergey for your prompt and thorough answer. :D
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
Post Reply