Page 1 of 1

Save header/footer in html

Posted: Wed Jun 06, 2012 9:22 am
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.

Posted: Fri Jun 08, 2012 8:47 am
by Sergey Tkachenko
As far as I know, HTML cannot store a page header/footer.

Posted: Wed Jun 13, 2012 11:38 am
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?

Posted: Thu Jun 14, 2012 8:34 am
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.

Posted: Thu Jun 14, 2012 10:10 am
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.

Posted: Thu Jun 14, 2012 9:35 pm
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.

Posted: Fri Jun 15, 2012 11:30 am
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;