Hello,
In the editor I have a TDBRichViewEdit. I assign a values for header and footer:
RVA_HeaderInfo.Text := 'this is a header';
RVA_FooteriNFO.Text := 'this is a footer';
In the page setup shows correctly the value assigned in RVA_HeaderInfo.Text and RVA_FooteriNFO.Text, also when I print in the edit shows the footer and header.
The problem is after save the report in the database and show it in a TDBRichViewEdit (or TDBRichView) and print it don't show the footer and header. What I do to show footer and header when I print??
My version of DBRichViewEdit is 11.0.5 and I use Delphi 6.
Header and footer don't print in TDBRichViewEdit
-
- Posts: 21
- Joined: Tue Nov 04, 2008 11:34 am
- Location: Barcelona (Catalonia)
- Contact:
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
RVA_Header/FooterInfo are used only when you print using TrvActionPrint ot TrvActionQuickPrint, and they are not saved in documents.
If you want to save them, see http://www.trichview.com/forums/viewtopic.php?t=3196
If you want to save them, see http://www.trichview.com/forums/viewtopic.php?t=3196
-
- Posts: 21
- Joined: Tue Nov 04, 2008 11:34 am
- Location: Barcelona (Catalonia)
- Contact:
-
- Posts: 21
- Joined: Tue Nov 04, 2008 11:34 am
- Location: Barcelona (Catalonia)
- Contact:
Header and footer in PDF
Hello,
I print header and footer correctly using TrvActionPrint but now I'll like to show the footer and header in a PDF document.
I try this:
DBRichview1 is a TDBRichView
rveFooter os a TrichViewEdit
RVPDF is a TRichViewPDF.
The compilation of the code is OK but in the generate PDF doesn't show the footer. Any advice?
Thanks.
I print header and footer correctly using TrvActionPrint but now I'll like to show the footer and header in a PDF document.
I try this:
Code: Select all
rve2 := TRichView(DBRichview1);
rveFooter.Clear;
RVEFooter.InsertText('footer page test');
rveFooter.Format;
RVE2.RTFReadProperties.SetFooter(rveFooter.RVData);
RVE2.Format;
RVPdf.RichView := Rve2;
RVPdf.SaveToPDFFile(path);
rveFooter os a TrichViewEdit
RVPDF is a TRichViewPDF.
The compilation of the code is OK but in the generate PDF doesn't show the footer. Any advice?
Thanks.
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
RichViewActions use TRVPrint.OnPagePrepaint to draw a header and a footer. They are drawn if printing is made using TRVPrint, and only by the specific actions.
TRichViewPDF - is this an old PDF component what is not available now?
I do not have its code now, but I suppose it uses TRVReportHelper to draw pages.
In order to draw a header or a footer, you need to modify its code: find the place of the code where it calls RVReportHelper.DrawPage (or DrawPageAt), and use Canvas.TextOut to draw the header/footer at the same coordinates.
TRichViewPDF - is this an old PDF component what is not available now?
I do not have its code now, but I suppose it uses TRVReportHelper to draw pages.
In order to draw a header or a footer, you need to modify its code: find the place of the code where it calls RVReportHelper.DrawPage (or DrawPageAt), and use Canvas.TextOut to draw the header/footer at the same coordinates.
-
- Posts: 21
- Joined: Tue Nov 04, 2008 11:34 am
- Location: Barcelona (Catalonia)
- Contact:
Thank your very much Sergey!
I modified TRVReportHelper.DrawPageAt in RVReport unit, and TRichViewPDF.SaveToPDFFile in trvpdf unit and works fine!
Ah, TRichViewPDF is a freeware VCL component to print TRichView on TRolePDF.Canvas:
author: mohab elsherif
version 1.03
I modified TRVReportHelper.DrawPageAt in RVReport unit, and TRichViewPDF.SaveToPDFFile in trvpdf unit and works fine!
Code: Select all
procedure TRVReportHelper.DrawPageAtWithHeaderAndFooter(Left, Top, APageNo: Integer;
ACanvas: TCanvas; APreview: Boolean; AHeight: Integer;header:string;footer:string);
var pt: TPoint;
begin
SetWindowOrgEx(ACanvas.Handle, -Left, -Top, @pt);
try
DrawPage(APageNo, ACanvas, APreview, AHeight);
acanvas.TextOut(-Left, -Top,header); //Grava capçalera
acanvas.TextOut(-Left, AHeight,footer); //Grava peu de pàgina
finally
SetWindowOrgEx(ACanvas.Handle, pt.x, pt.y, nil);
end;
end;
Code: Select all
procedure TRichViewPDF.SaveToPDFFileWithHeaderAndFooter(FileName: string; Header: string; Footer: String);
var
i, Parent, DocWidth, DocHeight, ATop, ALeft, ARight, ABottom: integer;
ms: TMemoryStream;
OldCursor: TCursor;
begin
[...]
FReportHelper.DrawPageAtWithHeaderAndFooter(ALeft, ATop, i + 1, FRolePDF.Canvas, false, DocHeight, header, footer);
[...]
end;
author: mohab elsherif
version 1.03