You've already forked lazarus-ccr
RxFPC: TRxDBGridPrint support merged cells
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5936 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -45,7 +45,8 @@ type
|
||||
rxpoShowGridColor,
|
||||
rxpoShowFooterColor,
|
||||
rxpoShowReportTitle,
|
||||
rxpoHideZeroValues
|
||||
rxpoHideZeroValues,
|
||||
rxpoColSpanning
|
||||
);
|
||||
TRxDBGridPrintOptions = set of TRxDBGridPrintOption;
|
||||
|
||||
@ -301,15 +302,25 @@ procedure TRxDBGridPrint.OnEnterRect(Memo: TStringList; View: TfrView);
|
||||
var
|
||||
i, k: Integer;
|
||||
F:TRxColInfo;
|
||||
FDataField:TField;
|
||||
FDataCollumn:TRxColumn;
|
||||
S: String;
|
||||
C:TColor;
|
||||
J: Integer;
|
||||
J, L, R: Integer;
|
||||
begin
|
||||
i := FColumnDataset.RecNo;
|
||||
View.Visible:=true;
|
||||
FDataField:=nil;
|
||||
FDataCollumn:=nil;
|
||||
|
||||
if (i >= 0) and (i < FRxColInfoList.Count) then
|
||||
begin
|
||||
F:=TRxColInfo(FRxColInfoList[i]);
|
||||
if Assigned(F) then
|
||||
FDataCollumn:=F.Col;
|
||||
if Assigned(FDataCollumn) then
|
||||
FDataField:=FDataCollumn.Field;
|
||||
|
||||
View.dx := F.ColWidth;
|
||||
|
||||
if Assigned(F.Col) and (Memo.Count>0) then
|
||||
@ -317,30 +328,72 @@ begin
|
||||
S:=Memo[0];
|
||||
if (S='[Cell]') and Assigned(F.Col.Field) then
|
||||
begin
|
||||
|
||||
if (rdgColSpanning in RxDBGrid.OptionsRx) and (rxpoColSpanning in Options) then
|
||||
begin
|
||||
if RxDBGrid.IsMerged(I + 1, L, R, FDataCollumn) then
|
||||
begin
|
||||
if I + 1 = L then
|
||||
begin
|
||||
if Assigned(FDataCollumn) then
|
||||
FDataField:=FDataCollumn.Field
|
||||
else
|
||||
begin
|
||||
if Assigned(F) then
|
||||
FDataCollumn:=F.Col;
|
||||
if Assigned(FDataCollumn) then
|
||||
FDataField:=FDataCollumn.Field;
|
||||
end;
|
||||
|
||||
for j:=L + 1 to R do
|
||||
if FRxColInfoList.Count > j - 1 then
|
||||
View.dx := View.dx + TRxColInfo(FRxColInfoList[j - 1]).ColWidth;
|
||||
end
|
||||
else
|
||||
begin
|
||||
View.Visible:=false;
|
||||
Memo[0] := '';
|
||||
exit;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if Assigned(F) then
|
||||
FDataCollumn:=F.Col;
|
||||
if Assigned(FDataCollumn) then
|
||||
FDataField:=FDataCollumn.Field;
|
||||
end
|
||||
end;
|
||||
|
||||
if not Assigned(FDataCollumn) then
|
||||
begin
|
||||
C:=0;
|
||||
end;
|
||||
|
||||
if rxpoShowGridColor in FOptions then
|
||||
begin
|
||||
C:=F.Col.Color;
|
||||
C:=FDataCollumn.Color;
|
||||
if Assigned(RxDBGrid.OnGetCellProps) then
|
||||
RxDBGrid.OnGetCellProps(RxDBGrid, F.Col.Field, TfrMemoView(View).Font, C);
|
||||
RxDBGrid.OnGetCellProps(RxDBGrid, FDataField, TfrMemoView(View).Font, C);
|
||||
if C = clWindow then
|
||||
C := clNone;
|
||||
TfrMemoView(View).FillColor:=C;
|
||||
end;
|
||||
|
||||
S:=F.Col.Field.DisplayText;
|
||||
if Assigned(F.Col) and (F.Col.KeyList.Count > 0) and (F.Col.PickList.Count > 0) then
|
||||
S:= FDataField.DisplayText; //F.Col.Field.DisplayText;
|
||||
if Assigned(FDataCollumn) and (FDataCollumn.KeyList.Count > 0) and (FDataCollumn.PickList.Count > 0) then
|
||||
begin
|
||||
J := F.Col.KeyList.IndexOf(S);
|
||||
if (J >= 0) and (J < F.Col.PickList.Count) then
|
||||
S := F.Col.PickList[j];
|
||||
J := FDataCollumn.KeyList.IndexOf(S);
|
||||
if (J >= 0) and (J < FDataCollumn.PickList.Count) then
|
||||
S := FDataCollumn.PickList[j];
|
||||
end
|
||||
else
|
||||
if (rxpoHideZeroValues in FOptions) and Assigned(F.Col.Field) and (F.Col.Field.DataType in [ftSmallint, ftInteger, ftWord,
|
||||
ftFloat, ftCurrency, ftLargeint]) and (F.Col.Field.AsFloat = 0) then
|
||||
if (rxpoHideZeroValues in FOptions) and Assigned(FDataField) and (FDataField.DataType in [ftSmallint, ftInteger, ftWord,
|
||||
ftFloat, ftCurrency, ftLargeint]) and (FDataField.AsFloat = 0) then
|
||||
S:='';
|
||||
|
||||
Memo[0] := S;
|
||||
TfrMemoView(View).Alignment:=F.Col.Alignment;
|
||||
TfrMemoView(View).Alignment:=FDataCollumn.Alignment;
|
||||
end else
|
||||
if Copy(S, 1, 7) = 'Header_' then
|
||||
begin
|
||||
@ -446,6 +499,7 @@ begin
|
||||
RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[3]:=rxpoShowGridColor in FOptions;
|
||||
RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[4]:=rxpoShowReportTitle in FOptions;
|
||||
RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[5]:=rxpoHideZeroValues in FOptions;
|
||||
RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[6]:=rxpoColSpanning in FOptions;
|
||||
|
||||
Result:=RxDBGridPrintGrid_SetupForm.ShowModal = mrOk;
|
||||
if Result then
|
||||
@ -477,6 +531,9 @@ begin
|
||||
if RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[5] then
|
||||
FOptions:=FOptions + [rxpoHideZeroValues];
|
||||
|
||||
if RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[6] then
|
||||
FOptions:=FOptions + [rxpoColSpanning];
|
||||
|
||||
FShowColumnHeaderOnAllPage:=RxDBGridPrintGrid_SetupForm.CheckBox1.Checked;
|
||||
end;
|
||||
RxDBGridPrintGrid_SetupForm.Free;
|
||||
|
@ -1,39 +1,38 @@
|
||||
object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
Left = 720
|
||||
Height = 344
|
||||
Height = 347
|
||||
Top = 303
|
||||
Width = 468
|
||||
Width = 489
|
||||
Caption = 'Print grid setup'
|
||||
ClientHeight = 344
|
||||
ClientWidth = 468
|
||||
ClientHeight = 347
|
||||
ClientWidth = 489
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.3'
|
||||
LCLVersion = '1.9.0.0'
|
||||
object GroupBox1: TGroupBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = CheckGroup1
|
||||
AnchorSideBottom.Control = CheckGroup1
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
AnchorSideBottom.Control = CheckBox1
|
||||
Left = 6
|
||||
Height = 173
|
||||
Height = 165
|
||||
Top = 6
|
||||
Width = 294
|
||||
Width = 316
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'Page margins'
|
||||
ClientHeight = 150
|
||||
ClientWidth = 290
|
||||
ClientHeight = 144
|
||||
ClientWidth = 314
|
||||
TabOrder = 0
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = GroupBox1
|
||||
AnchorSideBottom.Control = SpinEdit1
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 16
|
||||
Height = 20
|
||||
Top = 23
|
||||
Width = 24
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
@ -43,8 +42,8 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
object SpinEdit1: TSpinEdit
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
AnchorSideRight.Control = Label5
|
||||
Left = 79
|
||||
Height = 31
|
||||
Left = 91
|
||||
Height = 37
|
||||
Top = 6
|
||||
Width = 60
|
||||
Anchors = [akTop, akRight]
|
||||
@ -57,9 +56,9 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
AnchorSideBottom.Control = SpinEdit2
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 53
|
||||
Width = 26
|
||||
Height = 20
|
||||
Top = 66
|
||||
Width = 25
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'Left'
|
||||
@ -70,9 +69,9 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
AnchorSideTop.Control = SpinEdit1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Label5
|
||||
Left = 79
|
||||
Height = 31
|
||||
Top = 43
|
||||
Left = 91
|
||||
Height = 37
|
||||
Top = 49
|
||||
Width = 60
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
@ -84,8 +83,8 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
AnchorSideRight.Control = GroupBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 224
|
||||
Height = 31
|
||||
Left = 248
|
||||
Height = 37
|
||||
Top = 6
|
||||
Width = 60
|
||||
Anchors = [akTop, akRight]
|
||||
@ -98,10 +97,10 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideBottom.Control = SpinEdit3
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 146
|
||||
Height = 21
|
||||
Top = 16
|
||||
Width = 34
|
||||
Left = 158
|
||||
Height = 20
|
||||
Top = 23
|
||||
Width = 33
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = 'Right'
|
||||
ParentColor = False
|
||||
@ -111,10 +110,10 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideBottom.Control = SpinEdit4
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 146
|
||||
Height = 21
|
||||
Top = 53
|
||||
Width = 49
|
||||
Left = 158
|
||||
Height = 20
|
||||
Top = 66
|
||||
Width = 47
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = 'Bottom'
|
||||
ParentColor = False
|
||||
@ -124,9 +123,9 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = GroupBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 224
|
||||
Height = 31
|
||||
Top = 43
|
||||
Left = 248
|
||||
Height = 37
|
||||
Top = 49
|
||||
Width = 60
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
@ -137,7 +136,7 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
AnchorSideLeft.Control = GroupBox1
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
Left = 145
|
||||
Left = 157
|
||||
Height = 1
|
||||
Top = 0
|
||||
Width = 1
|
||||
@ -146,9 +145,9 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
end
|
||||
object ButtonPanel1: TButtonPanel
|
||||
Left = 6
|
||||
Height = 41
|
||||
Top = 297
|
||||
Width = 456
|
||||
Height = 46
|
||||
Top = 295
|
||||
Width = 477
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
HelpButton.Name = 'HelpButton'
|
||||
@ -164,10 +163,10 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 306
|
||||
Height = 173
|
||||
Left = 328
|
||||
Height = 201
|
||||
Top = 6
|
||||
Width = 156
|
||||
Width = 155
|
||||
Anchors = [akTop, akRight]
|
||||
AutoFill = True
|
||||
AutoSize = True
|
||||
@ -181,8 +180,8 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 150
|
||||
ClientWidth = 152
|
||||
ClientHeight = 180
|
||||
ClientWidth = 153
|
||||
Items.Strings = (
|
||||
'Show title'
|
||||
'Show footer'
|
||||
@ -190,20 +189,21 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
'Show grid color'
|
||||
'Show report title'
|
||||
'Hide zero values'
|
||||
'Merge cell''s'
|
||||
)
|
||||
TabOrder = 2
|
||||
Data = {
|
||||
06000000020202020202
|
||||
0700000002020202020202
|
||||
}
|
||||
end
|
||||
object RadioGroup1: TRadioGroup
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
AnchorSideTop.Control = CheckBox1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 69
|
||||
Top = 185
|
||||
Width = 106
|
||||
Top = 207
|
||||
Width = 107
|
||||
AutoFill = True
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
@ -215,8 +215,8 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 46
|
||||
ClientWidth = 102
|
||||
ClientHeight = 48
|
||||
ClientWidth = 105
|
||||
Items.Strings = (
|
||||
'Portrait'
|
||||
'Landscape'
|
||||
@ -226,12 +226,12 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
object Label6: TLabel
|
||||
AnchorSideLeft.Control = RadioGroup1
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
AnchorSideTop.Control = CheckBox1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 118
|
||||
Height = 21
|
||||
Top = 185
|
||||
Width = 75
|
||||
Left = 119
|
||||
Height = 20
|
||||
Top = 207
|
||||
Width = 72
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Report title'
|
||||
ParentColor = False
|
||||
@ -242,22 +242,25 @@ object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 124
|
||||
Height = 31
|
||||
Top = 212
|
||||
Width = 338
|
||||
Left = 125
|
||||
Height = 37
|
||||
Top = 233
|
||||
Width = 358
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
TabOrder = 4
|
||||
end
|
||||
object CheckBox1: TCheckBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = RadioGroup1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = CheckGroup1
|
||||
AnchorSideBottom.Control = CheckGroup1
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 260
|
||||
Width = 233
|
||||
Height = 24
|
||||
Top = 177
|
||||
Width = 235
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Show column header on all page'
|
||||
TabOrder = 5
|
||||
|
@ -84,6 +84,7 @@ begin
|
||||
CheckGroup1.Items[3]:=sShowGridColor;
|
||||
CheckGroup1.Items[4]:=sShowReportTitle;
|
||||
CheckGroup1.Items[5]:=sHideZeroValues;
|
||||
CheckGroup1.Items[6]:=sMergeCells;
|
||||
|
||||
|
||||
GroupBox1.Caption:=sPageMargins;
|
||||
|
Reference in New Issue
Block a user