TRxDBGridPrint - fix print with report title

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3447 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2014-08-08 05:32:55 +00:00
parent ff059e3420
commit bc8cc5acc2

View File

@@ -99,8 +99,9 @@ type
FYPos: Integer; FYPos: Integer;
FXPos: Integer; FXPos: Integer;
procedure DoShowReportTitle;
procedure DoCreateReport; procedure DoCreateReport;
procedure DoShowReportTitle;
procedure DoSetupColumns; procedure DoSetupColumns;
procedure DoShowColumnsTitle; procedure DoShowColumnsTitle;
procedure DoShowFooter; procedure DoShowFooter;
@@ -180,16 +181,14 @@ procedure TRxDBGridPrint.DoShowReportTitle;
var var
FBand: TfrBandView; FBand: TfrBandView;
FView: TfrMemoView; FView: TfrMemoView;
begin
if rxpoShowReportTitle in FOptions then
begin begin
FBand := TfrBandView(frCreateObject(gtBand, '', FPage)); FBand := TfrBandView(frCreateObject(gtBand, '', FPage));
FBand.SetBounds(10, 20, 1000, 25); FBand.SetBounds(10, FYPos, 1000, 25);
FBand.BandType := btReportTitle; FBand.BandType := btReportTitle;
FPage.Objects.Add(FBand); FPage.Objects.Add(FBand);
FView := frCreateObject(gtMemo, '', FPage) as TfrMemoView; FView := frCreateObject(gtMemo, '', FPage) as TfrMemoView;
FView.SetBounds(20, 20, FPage.PrnInfo.PgW - 40, 25); FView.SetBounds(FXPos, FYPos, FPage.PrnInfo.PgW - 40, 25);
FView.Alignment:=taCenter; FView.Alignment:=taCenter;
FView.Font.Size:=12; FView.Font.Size:=12;
// FView.Font.Assign(FTitleFont); // FView.Font.Assign(FTitleFont);
@@ -197,8 +196,7 @@ begin
FPage.Objects.Add(FView); FPage.Objects.Add(FView);
Inc(FYPos, 22) Inc(FYPos, 27)
end;
end; end;
procedure TRxDBGridPrint.DoCreateReport; procedure TRxDBGridPrint.DoCreateReport;
@@ -219,8 +217,10 @@ begin
FYPos:=FPageMargin.Top; FYPos:=FPageMargin.Top;
FXPos:=FPageMargin.Left; FXPos:=FPageMargin.Left;
if rxpoShowReportTitle in FOptions then
DoShowReportTitle; DoShowReportTitle;
if rxpoShowTitle in FOptions then
DoShowColumnsTitle; DoShowColumnsTitle;
FBand := TfrBandView(frCreateObject(gtBand, '', FPage)); FBand := TfrBandView(frCreateObject(gtBand, '', FPage));
@@ -258,7 +258,7 @@ var
i: Integer; i: Integer;
j: Integer; j: Integer;
begin begin
FTitleRowCount:=0; FTitleRowCount:=1;
FRxColInfoList.Clear; FRxColInfoList.Clear;
for i:=0 to RxDBGrid.Columns.Count-1 do for i:=0 to RxDBGrid.Columns.Count-1 do
begin begin
@@ -283,13 +283,11 @@ var
begin begin
FBand := TfrBandView(frCreateObject(gtBand, '', FPage)); FBand := TfrBandView(frCreateObject(gtBand, '', FPage));
FBand.BandType := btMasterHeader; FBand.BandType := btMasterHeader;
FBand.SetBounds(0, FYPos, 1000, 20 * FTitleRowCount);
if FShowColumnHeaderOnAllPage then
FBand.Flags:=FBand.Flags + flBandRepeatHeader;
FBand.SetBounds(FXPos, FYPos, 1000, 20 * FTitleRowCount);
FBand.Flags:=FBand.Flags or flStretched; FBand.Flags:=FBand.Flags or flStretched;
FPage.Objects.Add(FBand); FPage.Objects.Add(FBand);
if FShowColumnHeaderOnAllPage then
FBand.Flags:=FBand.Flags + flBandRepeatHeader;
for i:=0 to FTitleRowCount-1 do for i:=0 to FTitleRowCount-1 do
begin begin
@@ -388,6 +386,7 @@ begin
K:=StrToIntDef(Copy(S, 8, Length(S)), 0); K:=StrToIntDef(Copy(S, 8, Length(S)), 0);
if TRxColumnTitle(F.Col.Title).CaptionLinesCount = 0 then if TRxColumnTitle(F.Col.Title).CaptionLinesCount = 0 then
begin begin
S:=TRxColumnTitle(F.Col.Title).Caption;
if K = 0 then if K = 0 then
Memo[0] := TRxColumnTitle(F.Col.Title).Caption Memo[0] := TRxColumnTitle(F.Col.Title).Caption
else else