diff --git a/components/rx/trunk/Demos/RxDbGridExportToPDF/project1.lps b/components/rx/trunk/Demos/RxDbGridExportToPDF/project1.lps index 7f2c1baca..818d807ca 100644 --- a/components/rx/trunk/Demos/RxDbGridExportToPDF/project1.lps +++ b/components/rx/trunk/Demos/RxDbGridExportToPDF/project1.lps @@ -9,7 +9,7 @@ - + @@ -18,9 +18,8 @@ - - + @@ -35,9 +34,9 @@ - - - + + + @@ -87,16 +86,17 @@ + - - - + + + - + - + @@ -461,7 +461,7 @@ - + @@ -487,7 +487,7 @@ - + @@ -626,7 +626,7 @@ - + @@ -656,38 +656,38 @@ - + - + - + - + - + - + - + - + - + @@ -695,88 +695,92 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + + + + + - + @@ -791,13 +795,6 @@ - - - - - - - diff --git a/components/rx/trunk/rxdbgridexportpdf.pas b/components/rx/trunk/rxdbgridexportpdf.pas index a5628e370..9a7037bbf 100644 --- a/components/rx/trunk/rxdbgridexportpdf.pas +++ b/components/rx/trunk/rxdbgridexportpdf.pas @@ -540,10 +540,11 @@ end; procedure TRxDBGridExportPDF.DoExportTitle; var - i, X, CP, K, KY, TH1: Integer; - C: TRxColumn; + i, X, CP, K, KY, TH1, J, X1, W1: Integer; + C, FStartCol: TRxColumn; CT: TRxColumnTitle; H: LongInt; + KL: TMLCaptionItem; begin X:=FPageWidth + FPageMargin.Right; H:=THackExDBGrid(FRxDBGrid).RowHeights[0]; @@ -559,6 +560,7 @@ begin Inc(CP); FCurPage:=TPDFPage(FWorkPages[CP]); X:=FPageMargin.Left; + FStartCol:=C; end; CT:=C.Title as TRxColumnTitle; @@ -570,26 +572,40 @@ begin TH1:=CT.CaptionLine(K).Height * RxDBGrid.DefaultRowHeight; if K < CT.CaptionLinesCount-1 then begin - DrawRect(X, KY, {CT.CaptionLine(K).Width} C.Width, TH1, FRxDBGrid.BorderColor, FTitleColor); + if not Assigned(CT.CaptionLine(K).Next) then + begin + KL:=CT.CaptionLine(K); + X1:=X; + W1:=C.Width; + while Assigned(KL.Prior) and (KL.Col <> FStartCol) do + begin + KL:=KL.Prior; + X1:=X1 - KL.Col.Width; + W1:=W1 + KL.Col.Width; + end; - WriteTextRect(ActivateFont(C.Title.Font, FRxDBGrid.TitleFont), - X, KY, C.Width, TH1, CT.CaptionLine(K).Caption, C.Title.Alignment); + + + //DrawRect(X, KY, {CT.CaptionLine(K).Width} C.Width, TH1, FRxDBGrid.BorderColor, FTitleColor); + DrawRect(X1, KY, W1, TH1, FRxDBGrid.BorderColor, FTitleColor); + + //WriteTextRect(ActivateFont(C.Title.Font, FRxDBGrid.TitleFont), X, KY, C.Width, TH1, CT.CaptionLine(K).Caption, C.Title.Alignment); + WriteTextRect(ActivateFont(C.Title.Font, FRxDBGrid.TitleFont), X1, KY, W1, TH1, CT.CaptionLine(K).Caption, C.Title.Alignment); + end; KY:=KY + TH1; end else begin DrawRect(X, KY, {CT.CaptionLine(K).Width} C.Width, FPosY + H - KY, FRxDBGrid.BorderColor, FTitleColor); - WriteTextRect(ActivateFont(C.Title.Font, FRxDBGrid.TitleFont), - X, KY, C.Width, FPosY + H - KY, CT.CaptionLine(K).Caption, C.Title.Alignment); + WriteTextRect(ActivateFont(C.Title.Font, FRxDBGrid.TitleFont), X, KY, C.Width, FPosY + H - KY, CT.CaptionLine(K).Caption, C.Title.Alignment); end; end; end else begin DrawRect(X, FPosY, C.Width, H, FRxDBGrid.BorderColor, FTitleColor); - WriteTextRect(ActivateFont(C.Title.Font, FRxDBGrid.TitleFont), - X, FPosY, C.Width, H, C.Title.Caption, C.Title.Alignment); + WriteTextRect(ActivateFont(C.Title.Font, FRxDBGrid.TitleFont), X, FPosY, C.Width, H, C.Title.Caption, C.Title.Alignment); end; X:=X + C.Width; end;