diff --git a/components/rx/trunk/demos/rxdbgrid/MergeCell/project1.lpi b/components/rx/trunk/demos/rxdbgrid/MergeCell/project1.lpi
index d65aa0adf..68db62dd5 100644
--- a/components/rx/trunk/demos/rxdbgrid/MergeCell/project1.lpi
+++ b/components/rx/trunk/demos/rxdbgrid/MergeCell/project1.lpi
@@ -21,19 +21,22 @@
-
+
-
+
-
+
-
+
-
+
+
+
+
diff --git a/components/rx/trunk/demos/rxdbgrid/MergeCell/project1.lps b/components/rx/trunk/demos/rxdbgrid/MergeCell/project1.lps
index 0b5c9c34d..f69db466c 100644
--- a/components/rx/trunk/demos/rxdbgrid/MergeCell/project1.lps
+++ b/components/rx/trunk/demos/rxdbgrid/MergeCell/project1.lps
@@ -3,7 +3,7 @@
-
+
@@ -11,7 +11,7 @@
-
+
@@ -20,19 +20,18 @@
-
-
-
-
+
+
+
-
+
-
+
@@ -41,19 +40,19 @@
-
-
-
-
+
+
+
+
-
+
-
+
@@ -61,27 +60,27 @@
-
+
-
+
-
+
-
+
-
-
+
+
@@ -89,28 +88,28 @@
-
+
-
+
-
+
-
+
@@ -118,21 +117,21 @@
-
+
-
+
-
+
@@ -140,36 +139,36 @@
-
+
-
+
-
+
-
+
-
+
-
-
+
+
@@ -178,146 +177,185 @@
-
+
-
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/rx/trunk/demos/rxdbgrid/MergeCell/unit1.lfm b/components/rx/trunk/demos/rxdbgrid/MergeCell/unit1.lfm
index 6fe4022e4..3003f1ac8 100644
--- a/components/rx/trunk/demos/rxdbgrid/MergeCell/unit1.lfm
+++ b/components/rx/trunk/demos/rxdbgrid/MergeCell/unit1.lfm
@@ -10,8 +10,8 @@ object Form1: TForm1
LCLVersion = '1.9.0.0'
object RxDBGrid1: TRxDBGrid
Left = 0
- Height = 566
- Top = 54
+ Height = 570
+ Top = 50
Width = 770
ColumnDefValues.BlobText = '(данные)'
TitleButtons = False
@@ -121,7 +121,7 @@ object Form1: TForm1
FooterOptions.DrawFullLine = False
SearchOptions.QuickSearchOptions = [loCaseInsensitive, loPartialKey]
SearchOptions.FromStart = False
- OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgAllowQuickFilter]
+ OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgAllowQuickFilter, rdgAllowToolMenu]
Align = alClient
Color = clWindow
DrawFullLine = False
@@ -135,12 +135,12 @@ object Form1: TForm1
end
object Panel1: TPanel
Left = 0
- Height = 54
+ Height = 50
Top = 0
Width = 770
Align = alTop
AutoSize = True
- ClientHeight = 54
+ ClientHeight = 50
ClientWidth = 770
TabOrder = 1
object CheckBox1: TCheckBox
@@ -159,7 +159,7 @@ object Form1: TForm1
AnchorSideTop.Control = Panel1
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
- Left = 690
+ Left = 694
Height = 36
Top = 7
Width = 69
@@ -170,6 +170,20 @@ object Form1: TForm1
OnClick = Button1Click
TabOrder = 1
end
+ object Button2: TButton
+ AnchorSideTop.Control = Panel1
+ AnchorSideRight.Control = Button1
+ Left = 643
+ Height = 36
+ Top = 7
+ Width = 45
+ Anchors = [akTop, akRight]
+ AutoSize = True
+ BorderSpacing.Around = 6
+ Caption = 'Print'
+ OnClick = Button2Click
+ TabOrder = 2
+ end
end
object rxData: TRxMemoryData
FieldDefs = <
@@ -235,4 +249,15 @@ object Form1: TForm1
Left = 336
Top = 165
end
+ object RxDBGridPrint1: TRxDBGridPrint
+ RxDBGrid = RxDBGrid1
+ Caption = 'Печать списка'
+ ShowSetupForm = True
+ Options = [rxpoShowTitle, rxpoShowFooter, rxpoShowGridColor, rxpoShowFooterColor, rxpoShowReportTitle, rxpoHideZeroValues]
+ ShowProgress = True
+ ReportTitle = 'A'
+ ShowColumnHeaderOnAllPage = True
+ Left = 336
+ Top = 208
+ end
end
diff --git a/components/rx/trunk/demos/rxdbgrid/MergeCell/unit1.pas b/components/rx/trunk/demos/rxdbgrid/MergeCell/unit1.pas
index aafd3acef..4ccdcbf08 100644
--- a/components/rx/trunk/demos/rxdbgrid/MergeCell/unit1.pas
+++ b/components/rx/trunk/demos/rxdbgrid/MergeCell/unit1.pas
@@ -6,7 +6,8 @@ interface
uses
Classes, SysUtils, FileUtil, rxdbgrid, rxmemds, RxDBGridExportSpreadSheet,
- Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, db, Grids, DBGrids;
+ RxDBGridPrintGrid, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, db,
+ Grids, DBGrids;
type
@@ -14,6 +15,7 @@ type
TForm1 = class(TForm)
Button1: TButton;
+ Button2: TButton;
CheckBox1: TCheckBox;
dsData: TDataSource;
Panel1: TPanel;
@@ -23,7 +25,9 @@ type
RxDBGrid1: TRxDBGrid;
rxData: TRxMemoryData;
RxDBGridExportSpreadSheet1: TRxDBGridExportSpreadSheet;
+ RxDBGridPrint1: TRxDBGridPrint;
procedure Button1Click(Sender: TObject);
+ procedure Button2Click(Sender: TObject);
procedure CheckBox1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure RxDBGrid1Columns0DrawColumnCell(Sender: TObject;
@@ -79,8 +83,8 @@ begin
begin
ALeft:=1;
ARight:=3;
-{ if rxDataCODE.AsInteger > 10 then
- AColumn:=RxDBGrid1.ColumnByFieldName('DATE');}
+{ if rxDataCODE.AsInteger > 10 then
+ ADisplayColumn:=RxDBGrid1.ColumnByFieldName('DATE');}
end;
end;
@@ -97,5 +101,10 @@ begin
RxDBGridExportSpreadSheet1.Execute;
end;
+procedure TForm1.Button2Click(Sender: TObject);
+begin
+ RxDBGridPrint1.Execute;
+end;
+
end.
diff --git a/components/rx/trunk/rxdbgrid_print/rxdbgridprintgrid.pas b/components/rx/trunk/rxdbgrid_print/rxdbgridprintgrid.pas
index eb5bffc6c..d17393c88 100644
--- a/components/rx/trunk/rxdbgrid_print/rxdbgridprintgrid.pas
+++ b/components/rx/trunk/rxdbgrid_print/rxdbgridprintgrid.pas
@@ -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;
diff --git a/components/rx/trunk/rxdbgrid_print/rxdbgridprintgrid_setupunit.lfm b/components/rx/trunk/rxdbgrid_print/rxdbgridprintgrid_setupunit.lfm
index a4ca47a77..1abe162c8 100644
--- a/components/rx/trunk/rxdbgrid_print/rxdbgridprintgrid_setupunit.lfm
+++ b/components/rx/trunk/rxdbgrid_print/rxdbgridprintgrid_setupunit.lfm
@@ -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
diff --git a/components/rx/trunk/rxdbgrid_print/rxdbgridprintgrid_setupunit.pas b/components/rx/trunk/rxdbgrid_print/rxdbgridprintgrid_setupunit.pas
index 05a60bfbe..101583a30 100644
--- a/components/rx/trunk/rxdbgrid_print/rxdbgridprintgrid_setupunit.pas
+++ b/components/rx/trunk/rxdbgrid_print/rxdbgridprintgrid_setupunit.pas
@@ -84,6 +84,7 @@ begin
CheckGroup1.Items[3]:=sShowGridColor;
CheckGroup1.Items[4]:=sShowReportTitle;
CheckGroup1.Items[5]:=sHideZeroValues;
+ CheckGroup1.Items[6]:=sMergeCells;
GroupBox1.Caption:=sPageMargins;