You've already forked lazarus-ccr
TRxDBGridExportSpreadSheet - start code for export merged title cells
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3545 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -59,7 +59,7 @@
|
|||||||
<MinVersion Major="1" Release="18" Build="56" Valid="True"/>
|
<MinVersion Major="1" Release="18" Build="56" Valid="True"/>
|
||||||
</Item6>
|
</Item6>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="103">
|
<Units Count="104">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="RxDBGridDemo.lpr"/>
|
<Filename Value="RxDBGridDemo.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -73,8 +73,7 @@
|
|||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="RxDBGridMainUnit"/>
|
<UnitName Value="RxDBGridMainUnit"/>
|
||||||
<TopLine Value="78"/>
|
<CursorPos X="3" Y="10"/>
|
||||||
<CursorPos Y="80"/>
|
|
||||||
<UsageCount Value="99"/>
|
<UsageCount Value="99"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
@ -100,14 +99,13 @@
|
|||||||
<Unit5>
|
<Unit5>
|
||||||
<Filename Value="../../rxdbgrid.pas"/>
|
<Filename Value="../../rxdbgrid.pas"/>
|
||||||
<UnitName Value="rxdbgrid"/>
|
<UnitName Value="rxdbgrid"/>
|
||||||
<IsVisibleTab Value="True"/>
|
<EditorIndex Value="2"/>
|
||||||
<EditorIndex Value="1"/>
|
<TopLine Value="66"/>
|
||||||
<TopLine Value="3742"/>
|
<CursorPos Y="90"/>
|
||||||
<CursorPos Y="3763"/>
|
|
||||||
<UsageCount Value="17"/>
|
<UsageCount Value="17"/>
|
||||||
<Bookmarks Count="2">
|
<Bookmarks Count="2">
|
||||||
<Item0 Y="2564" ID="2"/>
|
<Item0 Y="2562" ID="2"/>
|
||||||
<Item1 Y="3763" ID="1"/>
|
<Item1 Y="3761" ID="1"/>
|
||||||
</Bookmarks>
|
</Bookmarks>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit5>
|
</Unit5>
|
||||||
@ -708,8 +706,18 @@
|
|||||||
<CursorPos X="2" Y="44"/>
|
<CursorPos X="2" Y="44"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit102>
|
</Unit102>
|
||||||
|
<Unit103>
|
||||||
|
<Filename Value="../../rxdbgridexportspreadsheet.pas"/>
|
||||||
|
<UnitName Value="RxDBGridExportSpreadSheet"/>
|
||||||
|
<IsVisibleTab Value="True"/>
|
||||||
|
<EditorIndex Value="1"/>
|
||||||
|
<TopLine Value="185"/>
|
||||||
|
<CursorPos X="2" Y="208"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit103>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="16" HistoryIndex="15">
|
<JumpHistory Count="19" HistoryIndex="18">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="../../rxdbgrid.pas"/>
|
<Filename Value="../../rxdbgrid.pas"/>
|
||||||
<Caret Line="867" Column="35" TopLine="845"/>
|
<Caret Line="867" Column="35" TopLine="845"/>
|
||||||
@ -774,6 +782,18 @@
|
|||||||
<Filename Value="rxdbgridmainunit.pas"/>
|
<Filename Value="rxdbgridmainunit.pas"/>
|
||||||
<Caret Line="161" Column="62" TopLine="158"/>
|
<Caret Line="161" Column="62" TopLine="158"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
|
<Position17>
|
||||||
|
<Filename Value="../../rxdbgrid.pas"/>
|
||||||
|
<Caret Line="3753" Column="6" TopLine="3743"/>
|
||||||
|
</Position17>
|
||||||
|
<Position18>
|
||||||
|
<Filename Value="rxdbgridmainunit.pas"/>
|
||||||
|
<Caret Line="80" TopLine="78"/>
|
||||||
|
</Position18>
|
||||||
|
<Position19>
|
||||||
|
<Filename Value="rxdbgridmainunit.pas"/>
|
||||||
|
<Caret Line="100" Column="50" TopLine="84"/>
|
||||||
|
</Position19>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
object RxDBGridMainForm: TRxDBGridMainForm
|
object RxDBGridMainForm: TRxDBGridMainForm
|
||||||
Left = 363
|
Left = 287
|
||||||
Height = 721
|
Height = 721
|
||||||
Top = 238
|
Top = 148
|
||||||
Width = 1187
|
Width = 1151
|
||||||
ActiveControl = Panel1
|
ActiveControl = Panel1
|
||||||
Caption = 'RxDBGrid Demo'
|
Caption = 'RxDBGrid Demo'
|
||||||
ClientHeight = 694
|
ClientHeight = 696
|
||||||
ClientWidth = 1187
|
ClientWidth = 1151
|
||||||
Menu = MainMenu1
|
Menu = MainMenu1
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
SessionProperties = 'RxDBGridExportSpreadSheet1.FileName;RxDBGridExportSpreadSheet1.OpenAfterExport;RxDBGridExportSpreadSheet1.Options;RxDBGridExportSpreadSheet1.PageName;RxDBGridPrint1.Options;RxDBGridPrint1.Orientation;RxDBGridPrint1.PageMargin;RxDBGridPrint1.ReportTitle;RxDBGridPrint1.ShowColumnHeaderOnAllPage'
|
SessionProperties = 'RxDBGridExportSpreadSheet1.FileName;RxDBGridExportSpreadSheet1.OpenAfterExport;RxDBGridExportSpreadSheet1.Options;RxDBGridExportSpreadSheet1.PageName;RxDBGridPrint1.Options;RxDBGridPrint1.Orientation;RxDBGridPrint1.PageMargin;RxDBGridPrint1.ReportTitle;RxDBGridPrint1.ShowColumnHeaderOnAllPage'
|
||||||
@ -14,9 +14,9 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
|||||||
LCLVersion = '1.3'
|
LCLVersion = '1.3'
|
||||||
object RxDBGrid1: TRxDBGrid
|
object RxDBGrid1: TRxDBGrid
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 624
|
Height = 630
|
||||||
Top = 70
|
Top = 66
|
||||||
Width = 1187
|
Width = 1151
|
||||||
TitleButtons = True
|
TitleButtons = True
|
||||||
AutoSort = True
|
AutoSort = True
|
||||||
OnGetCellProps = RxDBGrid1GetCellProps
|
OnGetCellProps = RxDBGrid1GetCellProps
|
||||||
@ -297,22 +297,22 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
|||||||
end
|
end
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 70
|
Height = 66
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 1187
|
Width = 1151
|
||||||
Align = alTop
|
Align = alTop
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
ClientHeight = 70
|
ClientHeight = 66
|
||||||
ClientWidth = 1187
|
ClientWidth = 1151
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
AnchorSideLeft.Control = Button2
|
AnchorSideLeft.Control = Button2
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideTop.Control = Panel1
|
||||||
Left = 270
|
Left = 262
|
||||||
Height = 21
|
Height = 19
|
||||||
Top = 7
|
Top = 7
|
||||||
Width = 36
|
Width = 34
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Mode'
|
Caption = 'Mode'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -321,9 +321,9 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
|||||||
AnchorSideLeft.Control = Panel1
|
AnchorSideLeft.Control = Panel1
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideTop.Control = Panel1
|
||||||
Left = 7
|
Left = 7
|
||||||
Height = 33
|
Height = 31
|
||||||
Top = 7
|
Top = 7
|
||||||
Width = 87
|
Width = 85
|
||||||
Action = actCalcTotal
|
Action = actCalcTotal
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
@ -333,10 +333,10 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
|||||||
AnchorSideLeft.Control = Button1
|
AnchorSideLeft.Control = Button1
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideTop.Control = Panel1
|
||||||
Left = 100
|
Left = 98
|
||||||
Height = 33
|
Height = 31
|
||||||
Top = 7
|
Top = 7
|
||||||
Width = 164
|
Width = 158
|
||||||
Action = actOptimizeColumnsWidthAll
|
Action = actOptimizeColumnsWidthAll
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
@ -347,11 +347,11 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = CheckBox2
|
AnchorSideTop.Control = CheckBox2
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 499
|
Left = 491
|
||||||
Height = 23
|
Height = 23
|
||||||
Hint = 'Use filter line'
|
Hint = 'Use filter line'
|
||||||
Top = 36
|
Top = 36
|
||||||
Width = 82
|
Width = 80
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
Caption = 'Use filter'
|
Caption = 'Use filter'
|
||||||
OnChange = CheckBox1Change
|
OnChange = CheckBox1Change
|
||||||
@ -361,9 +361,9 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
|||||||
AnchorSideLeft.Control = Label1
|
AnchorSideLeft.Control = Label1
|
||||||
AnchorSideTop.Control = Label1
|
AnchorSideTop.Control = Label1
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 276
|
Left = 268
|
||||||
Height = 29
|
Height = 27
|
||||||
Top = 34
|
Top = 32
|
||||||
Width = 217
|
Width = 217
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
@ -381,11 +381,11 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
|||||||
AnchorSideLeft.Control = ComboBox1
|
AnchorSideLeft.Control = ComboBox1
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideTop.Control = Panel1
|
||||||
Left = 499
|
Left = 491
|
||||||
Height = 23
|
Height = 23
|
||||||
Hint = 'Auto fill column width'
|
Hint = 'Auto fill column width'
|
||||||
Top = 7
|
Top = 7
|
||||||
Width = 131
|
Width = 125
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Auto fill columns'
|
Caption = 'Auto fill columns'
|
||||||
OnChange = CheckBox2Change
|
OnChange = CheckBox2Change
|
||||||
@ -395,10 +395,10 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
|||||||
AnchorSideLeft.Control = CheckBox2
|
AnchorSideLeft.Control = CheckBox2
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideTop.Control = Panel1
|
||||||
Left = 636
|
Left = 622
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 7
|
Top = 7
|
||||||
Width = 119
|
Width = 116
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Show indicator'
|
Caption = 'Show indicator'
|
||||||
Checked = True
|
Checked = True
|
||||||
@ -411,10 +411,10 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = CheckBox3
|
AnchorSideTop.Control = CheckBox3
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 636
|
Left = 622
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 36
|
Top = 36
|
||||||
Width = 115
|
Width = 112
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Show headers'
|
Caption = 'Show headers'
|
||||||
Checked = True
|
Checked = True
|
||||||
@ -426,10 +426,10 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
|||||||
AnchorSideLeft.Control = CheckBox3
|
AnchorSideLeft.Control = CheckBox3
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideTop.Control = Panel1
|
||||||
Left = 761
|
Left = 744
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 7
|
Top = 7
|
||||||
Width = 94
|
Width = 95
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Word wrap'
|
Caption = 'Word wrap'
|
||||||
OnChange = CheckBox5Change
|
OnChange = CheckBox5Change
|
||||||
|
@ -97,7 +97,7 @@ var
|
|||||||
|
|
||||||
procedure LocalizeApp;
|
procedure LocalizeApp;
|
||||||
implementation
|
implementation
|
||||||
uses rxsortmemds, FileUtil, gettext, translations, LCLVersion, rxFileUtils;
|
uses rxsortmemds, FileUtil, gettext, translations, rxFileUtils;
|
||||||
|
|
||||||
procedure LocalizeApp;
|
procedure LocalizeApp;
|
||||||
var
|
var
|
||||||
|
@ -36,12 +36,10 @@ unit rxdbgrid;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LResources, LCLVersion, LCLType, LCLIntf, Forms, Controls, Buttons,
|
Classes, SysUtils, LResources, LCLType, LCLIntf, Forms, Controls, Buttons,
|
||||||
Graphics, Dialogs, Grids, dbutils, DBGrids, DB, PropertyStorage, vclutils,
|
Graphics, Dialogs, Grids, dbutils, DBGrids, DB, PropertyStorage, vclutils,
|
||||||
LMessages, types, StdCtrls, Menus, rxspin;
|
LMessages, types, StdCtrls, Menus, rxspin;
|
||||||
|
|
||||||
{//$if ((lcl_major = 1) and (lcl_minor = 1))}
|
|
||||||
|
|
||||||
const
|
const
|
||||||
CBadQuickSearchSymbols = [VK_UNKNOWN..VK_HELP] + [VK_LWIN..VK_SLEEP] +
|
CBadQuickSearchSymbols = [VK_UNKNOWN..VK_HELP] + [VK_LWIN..VK_SLEEP] +
|
||||||
[VK_NUMLOCK..VK_SCROLL] + [VK_LSHIFT..VK_OEM_102] + [VK_PROCESSKEY] +
|
[VK_NUMLOCK..VK_SCROLL] + [VK_LSHIFT..VK_OEM_102] + [VK_PROCESSKEY] +
|
||||||
|
@ -107,6 +107,7 @@ var
|
|||||||
scColor : TsColor;
|
scColor : TsColor;
|
||||||
CB:TsCellBorders;
|
CB:TsCellBorders;
|
||||||
FMaxTitleHeight : integer;
|
FMaxTitleHeight : integer;
|
||||||
|
P: TMLCaptionItem;
|
||||||
begin
|
begin
|
||||||
FCurCol:=0;
|
FCurCol:=0;
|
||||||
FMaxTitleHeight:=1;
|
FMaxTitleHeight:=1;
|
||||||
@ -142,6 +143,7 @@ begin
|
|||||||
else
|
else
|
||||||
CB:=CB - [cbEast];
|
CB:=CB - [cbEast];
|
||||||
|
|
||||||
|
|
||||||
FWorksheet.WriteBorderColor(FCurRow + k ,FCurCol, cbSouth, scColorBlack);
|
FWorksheet.WriteBorderColor(FCurRow + k ,FCurCol, cbSouth, scColorBlack);
|
||||||
|
|
||||||
FWorksheet.WriteBorders(FCurRow + k, FCurCol, CB);
|
FWorksheet.WriteBorders(FCurRow + k, FCurCol, CB);
|
||||||
@ -149,6 +151,20 @@ begin
|
|||||||
FWorksheet.WriteHorAlignment(FCurRow + k, FCurCol, ssAligns[C.Title.Alignment]);
|
FWorksheet.WriteHorAlignment(FCurRow + k, FCurCol, ssAligns[C.Title.Alignment]);
|
||||||
|
|
||||||
FWorksheet.WriteUTF8Text(FCurRow + k, FCurCol, CT.CaptionLine(k).Caption);
|
FWorksheet.WriteUTF8Text(FCurRow + k, FCurCol, CT.CaptionLine(k).Caption);
|
||||||
|
|
||||||
|
if Assigned(CT.CaptionLine(k).Next) and not Assigned(CT.CaptionLine(k).Prior) then
|
||||||
|
begin
|
||||||
|
//Merge title cell
|
||||||
|
P:=CT.CaptionLine(k);
|
||||||
|
CC:=FCurCol;
|
||||||
|
while Assigned(P.Next) do
|
||||||
|
begin
|
||||||
|
Inc(CC);
|
||||||
|
P:=P.Next;
|
||||||
|
end;
|
||||||
|
if CC<>FCurCol then
|
||||||
|
FWorksheet.MergeCells(FCurRow, FCurCol, FCurRow, CC);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -176,6 +192,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{
|
||||||
|
if FMaxTitleHeight > 1 then
|
||||||
|
begin
|
||||||
|
for i:=0 to FRxDBGrid.Columns.Count-1 do
|
||||||
|
begin
|
||||||
|
C:=FRxDBGrid.Columns[i] as TRxColumn;
|
||||||
|
CT:=C.Title as TRxColumnTitle;
|
||||||
|
if CT.CaptionLinesCount < FMaxTitleHeight then
|
||||||
|
begin
|
||||||
|
FWorksheet.MergeCells( FCurRow + CT.CaptionLinesCount, I, FCurRow + FMaxTitleHeight - 1, I);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
}
|
||||||
inc(FCurRow, FMaxTitleHeight);
|
inc(FCurRow, FMaxTitleHeight);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user