Page 1 of 1
Headers
Posted: Sun Apr 22, 2012 4:35 pm
by don709
I've been trying for days to load a .rtf file into a header.
None of the demos seem to do this. All I can figure out from the examples is how to write a line of text to the header canvas. It's all very cryptic indeed.
Anyone have a simple example of how to load a .rtf file into the header.
And how to turn the header on or off.
I need to give the user the ability to choose different headers from different files at run time.
Cheers
Don
Posted: Mon Apr 23, 2012 9:06 am
by Sergey Tkachenko
See the demo in Demos\*\Assorted\Printing\Headers\
You will see that a header and a footer can be loaded in a separate TRichView.
Unfortunately, the current version allows only to display in this way only the same header and footer for all pages, even page numbers cannot be inserted.
Headers
Posted: Mon Apr 23, 2012 10:31 am
by don709
How about an example of using headers with
SRichViewEdit and
SRVPrint
The example in Assorted/Printing/Headers, along with all the other header examples, deal with regular RichViewEdit and RVPrint. Those examples seem to be very different and I'm sorry to say I can't figure out how to make the transition.
It took me a long time to get the Gnostic PDF engine working with SRichViewEdit so I don't really want to set them back to regular RichView
Here's a perfect world for me
if FileExists(ExeDir+'MedicalTemplates\Header.rtf') then
begin
rvHeader.Clear;
rvHeader.DeleteUnusedStyles(True,True,True);
rvHeader.LoadRTF(ExeDir+'MedicalTemplates\Header.rtf');
rvHeader.Format;
* RVE.
SomeCodeToAdd.RVHeader.to.RVE(rvHeader.RVDate);
end;
Cheers
Don
Posted: Mon Apr 23, 2012 10:47 am
by Sergey Tkachenko
In TSRichViewEdit, it's even more simple, you do not need external editors.
To load RTF containing headers, just use SRichViewEdit.RichViewEdit.LoadRTF(). If this RTF contains a header and/or a footer, they will be loaded.
If you want to load some document _in_ a header, use SRichViewEdit.RVHeader.LoadRTF().
Note: some versions of ActionTest demos for TSRichViewEdit had rvrtfSaveHeaderFooter mistakenly excluded from SRichViewEdit1.RTFOptions, so they could not save documents with header of footer. Include this option back manually.
Headers
Posted: Tue Apr 24, 2012 9:44 am
by don709
Wow... that was easy. Thanks very much.