From 66144885adf6ef748f710cae03a04727b0d9f590 Mon Sep 17 00:00:00 2001 From: Jean-Marc Levecque Date: Thu, 22 Dec 2011 06:55:08 +0100 Subject: Add image to header and footer Add image to header and footer for display/print to each page of a section Signed-off-by: Jean-Marc Levecque --- extras/contributed/report_tool/demo/u_demo.pas | 4 ++- .../report_tool/reportengine/u_command.pas | 29 ++++++++++++++++------ 2 files changed, 25 insertions(+), 8 deletions(-) (limited to 'extras') diff --git a/extras/contributed/report_tool/demo/u_demo.pas b/extras/contributed/report_tool/demo/u_demo.pas index 390a2a60..c42f9d3b 100644 --- a/extras/contributed/report_tool/demo/u_demo.pas +++ b/extras/contributed/report_tool/demo/u_demo.pas @@ -1531,13 +1531,15 @@ with FReport do // write page number and total of pages on each page NumPageFooter(cnRight,lnEnd,'Page','of',True,ColDefaut,FtText,IlText); // paint some images - ImagePage(30,30,'poppy.jpg',4); + ImageHeader(10,12,'poppy.jpg',4); ImagePage(40,50,'poppy.jpg',3); ImagePage(50,80,'poppy.jpg',2); ImagePage(60,140,'poppy.jpg'); ImagePage(100,30,'radiobuttons.bmp'); Page; ImagePage(80,30,'poppy-nb.jpg'); + ImagePage(30,120,'poppy.jpg',2); + Page; // preparation is finished, so create PDF objects EndWrite; end; diff --git a/extras/contributed/report_tool/reportengine/u_command.pas b/extras/contributed/report_tool/reportengine/u_command.pas index 876d9a71..2f51978b 100644 --- a/extras/contributed/report_tool/reportengine/u_command.pas +++ b/extras/contributed/report_tool/reportengine/u_command.pas @@ -26,7 +26,7 @@ uses U_Pdf; type - TZone = (zEnTete,zPied,zPage,zMarges); + TZone = (zHeader,zFooter,zPage,zMargins); TSectPageNum = (PageNum,SectNum,PSectNum); TBorderFlags= set of (bfLeft,bfRight,bfTop,bfBottom); @@ -76,12 +76,14 @@ type procedure LoadSpaceGroup(AHeight: Single); procedure LoadFrame(AStyle: Integer; AZone: TZone); procedure LoadLine(APosXBegin,APosYBegin: Single; AColumn: Integer; APosXEnd,APosYEnd: Single; AStyle: Integer); - procedure LoadLineHorizEnTete(APosXBegin,APosYBegin: Single; AColumn: Integer; APosXEnd,APosYEnd: Single; AStyle: Integer); + procedure LoadLineHorizHeader(APosXBegin,APosYBegin: Single; AColumn: Integer; APosXEnd,APosYEnd: Single; AStyle: Integer); procedure LoadLineHorizPage(APosXBegin,APosYBegin: Single; AColumn: Integer; APosXEnd,APosYEnd: Single; AStyle: Integer); - procedure LoadLineHorizPied(APosXBegin,APosYBegin: Single; AColumn: Integer; APosXEnd,APosYEnd: Single; AStyle: Integer); + procedure LoadLineHorizFooter(APosXBegin,APosYBegin: Single; AColumn: Integer; APosXEnd,APosYEnd: Single; AStyle: Integer); procedure LoadLineHorizGroupe(AHeight: Single); procedure LoadSurf(APos: T_Points; AColor: TfpgColor); - procedure LoadImg(APosX,APosY,AImgNum: Integer); + procedure LoadImgHeader(APosX,APosY,AImgNum: Integer); + procedure LoadImgPage(APosX,APosY,AImgNum: Integer); + procedure LoadImgFooter(APosX,APosY,AImgNum: Integer); function GetCmdPage(NumPage: Integer): TList; property CmdHeader: TList read FHeader; property CmdFooter: TList read FFooter; @@ -353,6 +355,7 @@ var Sections: TList; // Columns: TList; Texts: TStringList; + ImageNames: TStringList; Fonts: TList; LineSpaces: TList; BackColors: TList; @@ -546,7 +549,7 @@ VCommand:= T_Line.Create(APosXBegin,APosYBegin,AColumn,AStyle,APosXEnd,APosYEnd) T_Page(Pages[Pred(FPages.Count)]).Commands.Add(VCommand); end; -procedure T_Section.LoadLineHorizEnTete(APosXBegin,APosYBegin: Single; AColumn: Integer; APosXEnd,APosYEnd: Single; +procedure T_Section.LoadLineHorizHeader(APosXBegin,APosYBegin: Single; AColumn: Integer; APosXEnd,APosYEnd: Single; AStyle: Integer); begin VCommand:= T_Line.Create(APosXBegin,APosYBegin,AColumn,AStyle,APosXEnd,APosYEnd); @@ -559,7 +562,7 @@ VCommand:= T_Line.Create(APosXBegin,APosYBegin,AColumn,AStyle,APosXEnd,APosYEnd) T_Page(Pages[Pred(FPages.Count)]).Commands.Add(VCommand); end; -procedure T_Section.LoadLineHorizPied(APosXBegin,APosYBegin: Single; AColumn: Integer; APosXEnd,APosYEnd: Single; AStyle: Integer); +procedure T_Section.LoadLineHorizFooter(APosXBegin,APosYBegin: Single; AColumn: Integer; APosXEnd,APosYEnd: Single; AStyle: Integer); begin VCommand:= T_Line.Create(APosXBegin,APosYBegin,AColumn,AStyle,APosXEnd,APosYEnd); FFooter.Add(VCommand); @@ -576,12 +579,24 @@ VCommand:= T_Surface.Create(APos,AColor); T_Page(Pages[Pred(FPages.Count)]).Commands.Add(VCommand); end; -procedure T_Section.LoadImg(APosX,APosY,AImgNum: Integer); +procedure T_Section.LoadImgHeader(APosX,APosY,AImgNum: Integer); +begin +VCommand:= T_Image.Create(APosX,APosY,AImgNum); +FHeader.Add(VCommand); +end; + +procedure T_Section.LoadImgPage(APosX,APosY,AImgNum: Integer); begin VCommand:= T_Image.Create(APosX,APosY,AImgNum); T_Page(Pages[Pred(FPages.Count)]).Commands.Add(VCommand); end; +procedure T_Section.LoadImgFooter(APosX,APosY,AImgNum: Integer); +begin +VCommand:= T_Image.Create(APosX,APosY,AImgNum); +FFooter.Add(VCommand); +end; + function T_Section.GetCmdPage(NumPage: Integer): TList; begin Result:= T_Page(Pages[Pred(NumPage)]).Commands; -- cgit v1.2.3-70-g09d2