Save header/footer in html

General TRichView support forum. Please post your questions here
Post Reply
Novel SPb
Posts: 6
Joined: Tue Oct 14, 2008 10:49 am

Save header/footer in html

Post by Novel SPb »

Hello.

What is the best way to export RichViewEdit content with header/footer (in additional TRichViewEdit components) to the html-file? I want to obtain the same look of the html document, as I can see this one in print/preview actions.

Thanks.
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

As far as I know, HTML cannot store a page header/footer.
Novel SPb
Posts: 6
Joined: Tue Oct 14, 2008 10:49 am

Post by Novel SPb »

Yes, it cannot. All I want is to have "rtf-like" printout, with header/footer inserted in place of pagebreaks in original document.
I try to process OnSaveItemToFile and OnSaveParaToHTML events, but cannot catch item with rvsBreak style (.
Is there a simplest way to do something similar?
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

rvsBreak is not a page break, it is just a line, <hr> in HTML.
Documents may have not only explicit page breaks, page breaks may be added automatically, depending on the page size and orientation. And they can be different for different users.
Novel SPb
Posts: 6
Joined: Tue Oct 14, 2008 10:49 am

Post by Novel SPb »

You are right. The ideal solution can be to "draw" document to the "html-canvas", as TReportHelper does with casual canvas, but it seems to be very difficult in implementation, so I try to find an easiest way. A minimal goal is to have header/footer inserted in explicit page breaks places of the document.
wanderingwino
Posts: 15
Joined: Mon May 07, 2012 5:14 pm

Post by wanderingwino »

I'm trying to figure out how todo the same thing.

Would be nice if it created a html5 document as it seems to support header/footer/ and foot notes pretty nicely.
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

As I understand, <header> and <footer> in HTML5 are not page header/footer, but something like a top and a bottom part of the site containing menus, logos, etc. They are designed to help search engines to find the main content of HTML page.

The code for inserting a header may be:

Code: Select all

// header is in Stream
for i := rv.ItemCout-1 downto 0 do
  if (i=0) or (rv.PageBreaksBeforeItems[i]) then begin
     rv.PageBreaksBeforeItems[i] := 0;
     Stream.Position := 0;
     rv.InsertRVFFromStream(Stream, i);
  end;
Post Reply