Стартовый пул
This commit is contained in:
BIN
RXLib/demos/rxdbgrid/RxDBGrid_ExportSpreadsheet/project1.ico
Normal file
BIN
RXLib/demos/rxdbgrid/RxDBGrid_ExportSpreadsheet/project1.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
86
RXLib/demos/rxdbgrid/RxDBGrid_ExportSpreadsheet/project1.lpi
Normal file
86
RXLib/demos/rxdbgrid/RxDBGrid_ExportSpreadsheet/project1.lpi
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="10"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="project1"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="4">
|
||||
<Item1>
|
||||
<PackageName Value="rxdbgrid_export_spreadsheet"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="FCL"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="rxnew"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item4>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Target>
|
||||
<Filename Value="project1"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
25
RXLib/demos/rxdbgrid/RxDBGrid_ExportSpreadsheet/project1.lpr
Normal file
25
RXLib/demos/rxdbgrid/RxDBGrid_ExportSpreadsheet/project1.lpr
Normal file
@@ -0,0 +1,25 @@
|
||||
program project1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms,
|
||||
sysutils,
|
||||
Unit1,
|
||||
rxnew
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
DefaultFormatSettings.ThousandSeparator:=' ';
|
||||
RequireDerivedFormResource := True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
306
RXLib/demos/rxdbgrid/RxDBGrid_ExportSpreadsheet/unit1.lfm
Normal file
306
RXLib/demos/rxdbgrid/RxDBGrid_ExportSpreadsheet/unit1.lfm
Normal file
@@ -0,0 +1,306 @@
|
||||
object Form1: TForm1
|
||||
Left = 381
|
||||
Height = 527
|
||||
Top = 195
|
||||
Width = 746
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 527
|
||||
ClientWidth = 746
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
ShowHint = True
|
||||
LCLVersion = '1.7'
|
||||
object RxDBGrid1: TRxDBGrid
|
||||
Left = 0
|
||||
Height = 450
|
||||
Hint = 'Список данных'
|
||||
Top = 77
|
||||
Width = 746
|
||||
ColumnDefValues.BlobText = '(blob)'
|
||||
TitleButtons = True
|
||||
AutoSort = True
|
||||
Columns = <
|
||||
item
|
||||
Color = clMoneyGreen
|
||||
Title.Alignment = taCenter
|
||||
Title.Orientation = toHorizontal
|
||||
Title.Caption = 'CODE'
|
||||
Width = 90
|
||||
FieldName = 'CODE'
|
||||
EditButtons = <>
|
||||
Filter.IsNull = False
|
||||
Filter.IsAll = True
|
||||
Filter.DropDownRows = 0
|
||||
Filter.EmptyValue = '(Нет)'
|
||||
Filter.AllValue = '(Все значения)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
Footers = <>
|
||||
end
|
||||
item
|
||||
Color = clAqua
|
||||
Title.Alignment = taCenter
|
||||
Title.Orientation = toHorizontal
|
||||
Title.Caption = 'NAME'
|
||||
Width = 350
|
||||
FieldName = 'NAME'
|
||||
EditButtons = <>
|
||||
Filter.IsNull = False
|
||||
Filter.IsAll = True
|
||||
Filter.DropDownRows = 0
|
||||
Filter.EmptyValue = '(Нет)'
|
||||
Filter.AllValue = '(Все значения)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
Footers = <
|
||||
item
|
||||
Alignment = taRightJustify
|
||||
Value = 'Min value'
|
||||
ValueType = fvtStaticText
|
||||
end
|
||||
item
|
||||
Alignment = taRightJustify
|
||||
Value = 'Max value'
|
||||
ValueType = fvtStaticText
|
||||
end
|
||||
item
|
||||
Alignment = taRightJustify
|
||||
Value = 'Summa'
|
||||
ValueType = fvtStaticText
|
||||
end>
|
||||
end
|
||||
item
|
||||
Title.Alignment = taCenter
|
||||
Title.Orientation = toHorizontal
|
||||
Title.Caption = 'PRICE'
|
||||
Width = 120
|
||||
FieldName = 'PRICE'
|
||||
EditButtons = <>
|
||||
Filter.IsNull = False
|
||||
Filter.IsAll = True
|
||||
Filter.DropDownRows = 0
|
||||
Filter.EmptyValue = '(Нет)'
|
||||
Filter.AllValue = '(Все значения)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
Footer.Alignment = taRightJustify
|
||||
Footer.FieldName = 'PRICE'
|
||||
Footer.ValueType = fvtSum
|
||||
Footers = <
|
||||
item
|
||||
Alignment = taRightJustify
|
||||
FieldName = 'PRICE'
|
||||
ValueType = fvtMin
|
||||
end
|
||||
item
|
||||
Alignment = taRightJustify
|
||||
FieldName = 'PRICE'
|
||||
ValueType = fvtMax
|
||||
end
|
||||
item
|
||||
Alignment = taRightJustify
|
||||
FieldName = 'PRICE'
|
||||
ValueType = fvtSum
|
||||
end>
|
||||
end>
|
||||
KeyStrokes = <
|
||||
item
|
||||
Command = rxgcShowFindDlg
|
||||
ShortCut = 16454
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcShowColumnsDlg
|
||||
ShortCut = 16471
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcShowFilterDlg
|
||||
ShortCut = 16468
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcShowSortDlg
|
||||
ShortCut = 16467
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcShowQuickFilter
|
||||
ShortCut = 16465
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcHideQuickFilter
|
||||
ShortCut = 16456
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcSelectAll
|
||||
ShortCut = 16449
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcDeSelectAll
|
||||
ShortCut = 16429
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcInvertSelection
|
||||
ShortCut = 16426
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcOptimizeColumnsWidth
|
||||
ShortCut = 16427
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcCopyCellValue
|
||||
ShortCut = 16451
|
||||
Enabled = True
|
||||
end>
|
||||
FooterOptions.Active = True
|
||||
FooterOptions.Color = clYellow
|
||||
FooterOptions.RowCount = 3
|
||||
FooterOptions.DrawFullLine = False
|
||||
SearchOptions.QuickSearchOptions = [loCaseInsensitive, loPartialKey]
|
||||
SearchOptions.FromStart = False
|
||||
OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgFooterRows, rdgAllowToolMenu]
|
||||
FooterColor = clYellow
|
||||
FooterRowCount = 3
|
||||
OnDataHintShow = RxDBGrid1DataHintShow
|
||||
Align = alClient
|
||||
Color = clWindow
|
||||
DrawFullLine = False
|
||||
FocusColor = clRed
|
||||
SelectedColor = clHighlight
|
||||
GridLineStyle = psSolid
|
||||
DataSource = DataSource1
|
||||
Options = [dgEditing, dgTitles, dgIndicator, dgColumnResize, dgColumnMove, dgColLines, dgRowLines, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit, dgMultiselect, dgHeaderPushedLook]
|
||||
ParentColor = False
|
||||
TabOrder = 0
|
||||
TitleStyle = tsNative
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 77
|
||||
Top = 0
|
||||
Width = 746
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
ClientHeight = 77
|
||||
ClientWidth = 746
|
||||
TabOrder = 1
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = Panel1
|
||||
Left = 7
|
||||
Height = 20
|
||||
Top = 7
|
||||
Width = 145
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'SpeadSheet file name '
|
||||
ParentColor = False
|
||||
end
|
||||
object FileNameEdit1: TFileNameEdit
|
||||
AnchorSideLeft.Control = Label1
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 13
|
||||
Height = 37
|
||||
Hint = 'Укажите имя файла'
|
||||
Top = 33
|
||||
Width = 275
|
||||
FilterIndex = 0
|
||||
HideDirectories = False
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 1
|
||||
BorderSpacing.Around = 6
|
||||
MaxLength = 0
|
||||
TabOrder = 0
|
||||
end
|
||||
object Button1: TButton
|
||||
AnchorSideLeft.Control = FileNameEdit1
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = FileNameEdit1
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 294
|
||||
Height = 33
|
||||
Hint = 'Начать выгрузку'
|
||||
Top = 35
|
||||
Width = 87
|
||||
Caption = 'Export data'
|
||||
OnClick = Button1Click
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object RxMemoryData1: TRxMemoryData
|
||||
FieldDefs = <
|
||||
item
|
||||
Name = 'CODE'
|
||||
DataType = ftInteger
|
||||
end
|
||||
item
|
||||
Name = 'NAME'
|
||||
DataType = ftString
|
||||
Size = 300
|
||||
end
|
||||
item
|
||||
Name = 'PRICE'
|
||||
DataType = ftCurrency
|
||||
end>
|
||||
PacketRecords = 0
|
||||
left = 368
|
||||
top = 184
|
||||
object RxMemoryData1CODE: TLongintField
|
||||
DisplayWidth = 10
|
||||
FieldKind = fkData
|
||||
FieldName = 'CODE'
|
||||
Index = 0
|
||||
LookupCache = False
|
||||
ProviderFlags = [pfInUpdate, pfInWhere]
|
||||
ReadOnly = False
|
||||
Required = False
|
||||
end
|
||||
object RxMemoryData1NAME: TStringField
|
||||
DisplayWidth = 300
|
||||
FieldKind = fkData
|
||||
FieldName = 'NAME'
|
||||
Index = 1
|
||||
LookupCache = False
|
||||
ProviderFlags = [pfInUpdate, pfInWhere]
|
||||
ReadOnly = False
|
||||
Required = False
|
||||
Size = 300
|
||||
end
|
||||
object RxMemoryData1PRICE: TCurrencyField
|
||||
DisplayWidth = 10
|
||||
FieldKind = fkData
|
||||
FieldName = 'PRICE'
|
||||
Index = 2
|
||||
LookupCache = False
|
||||
ProviderFlags = [pfInUpdate, pfInWhere]
|
||||
ReadOnly = False
|
||||
Required = False
|
||||
MaxValue = 0
|
||||
MinValue = 0
|
||||
Precision = 2
|
||||
end
|
||||
end
|
||||
object DataSource1: TDataSource
|
||||
DataSet = RxMemoryData1
|
||||
left = 328
|
||||
top = 184
|
||||
end
|
||||
object RxDBGridExportSpreadSheet1: TRxDBGridExportSpreadSheet
|
||||
RxDBGrid = RxDBGrid1
|
||||
Caption = 'Экспорт в электронную таблицу'
|
||||
ShowSetupForm = True
|
||||
OnBeforeExecute = RxDBGridExportSpreadSheet1BeforeExecute
|
||||
PageName = 'Test page'
|
||||
Options = [ressExportTitle, ressExportColors, ressExportFooter, ressExportFormula, ressOverwriteExisting]
|
||||
OpenAfterExport = True
|
||||
left = 336
|
||||
top = 256
|
||||
end
|
||||
end
|
88
RXLib/demos/rxdbgrid/RxDBGrid_ExportSpreadsheet/unit1.pas
Normal file
88
RXLib/demos/rxdbgrid/RxDBGrid_ExportSpreadsheet/unit1.pas
Normal file
@@ -0,0 +1,88 @@
|
||||
unit Unit1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, rxdbgrid, rxmemds, RxDBGridExportSpreadSheet,
|
||||
Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, EditBtn, db, Types, Grids;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
Button1: TButton;
|
||||
DataSource1: TDataSource;
|
||||
FileNameEdit1: TFileNameEdit;
|
||||
Label1: TLabel;
|
||||
Panel1: TPanel;
|
||||
RxDBGrid1: TRxDBGrid;
|
||||
RxDBGridExportSpreadSheet1: TRxDBGridExportSpreadSheet;
|
||||
RxMemoryData1: TRxMemoryData;
|
||||
RxMemoryData1CODE: TLongintField;
|
||||
RxMemoryData1NAME: TStringField;
|
||||
RxMemoryData1PRICE: TCurrencyField;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure RxDBGrid1DataHintShow(Sender: TObject; CursorPos: TPoint;
|
||||
Cell: TGridCoord; Column: TRxColumn; var HintStr: string;
|
||||
var Processed: boolean);
|
||||
procedure RxDBGridExportSpreadSheet1BeforeExecute(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
uses LCLIntf;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
i:integer;
|
||||
begin
|
||||
RxMemoryData1.Open;
|
||||
//fill test values
|
||||
for i:=1 to 50 do
|
||||
begin
|
||||
RxMemoryData1.Append;
|
||||
RxMemoryData1CODE.AsInteger:=i;
|
||||
RxMemoryData1NAME.AsString:=Format('Line %d', [i]);
|
||||
RxMemoryData1PRICE.AsFloat:=Random * 100 + 5;
|
||||
RxMemoryData1.Post;
|
||||
end;
|
||||
RxMemoryData1.First;
|
||||
|
||||
FileNameEdit1.Text:='test1.ods';
|
||||
end;
|
||||
|
||||
procedure TForm1.RxDBGrid1DataHintShow(Sender: TObject; CursorPos: TPoint;
|
||||
Cell: TGridCoord; Column: TRxColumn; var HintStr: string;
|
||||
var Processed: boolean);
|
||||
begin
|
||||
HintStr:='Это очень чётная строка! ' + HintStr;
|
||||
Processed:=true;
|
||||
end;
|
||||
|
||||
procedure TForm1.RxDBGridExportSpreadSheet1BeforeExecute(Sender: TObject);
|
||||
begin
|
||||
RxDBGridExportSpreadSheet1.FileName:=FileNameEdit1.Text;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
begin
|
||||
RxDBGridExportSpreadSheet1.Execute;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user