RxFPC:TRxDBGridExportSpreadSheet - new flag - ressHideZeroValues

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5900 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75 2017-05-25 20:00:14 +00:00
parent 35aab9fbed
commit be4e118c53
8 changed files with 93 additions and 38 deletions

View File

@ -133,6 +133,11 @@ msgstr ""
msgid "Export footer formula"
msgstr ""
#: rxdconst.sexporthidezerovalues
msgctxt "rxdconst.sexporthidezerovalues"
msgid "Hide zero values"
msgstr ""
#: rxdconst.sexportimages
msgid "Export images"
msgstr ""
@ -254,6 +259,7 @@ msgid "Global"
msgstr ""
#: rxdconst.shidezerovalues
msgctxt "rxdconst.shidezerovalues"
msgid "Hide zero values"
msgstr ""

View File

@ -127,6 +127,11 @@ msgstr ""
msgid "Export footer formula"
msgstr ""
#: rxdconst.sexporthidezerovalues
msgctxt "rxdconst.sexporthidezerovalues"
msgid "Hide zero values"
msgstr ""
#: rxdconst.sexportimages
msgid "Export images"
msgstr ""
@ -244,6 +249,7 @@ msgid "Global"
msgstr ""
#: rxdconst.shidezerovalues
msgctxt "rxdconst.shidezerovalues"
msgid "Hide zero values"
msgstr ""

View File

@ -137,6 +137,12 @@ msgstr "Имя файла экспорта"
msgid "Export footer formula"
msgstr "Экспортирововать формулы итоговой строки"
#: rxdconst.sexporthidezerovalues
#, fuzzy
msgctxt "rxdconst.sexporthidezerovalues"
msgid "Hide zero values"
msgstr "Не отображать нулевые значения"
#: rxdconst.sexportimages
msgid "Export images"
msgstr "Экспорт изображений"
@ -254,6 +260,7 @@ msgid "Global"
msgstr "Общее"
#: rxdconst.shidezerovalues
msgctxt "rxdconst.shidezerovalues"
msgid "Hide zero values"
msgstr "Не отображать нулевые значения"

View File

@ -138,6 +138,12 @@ msgstr "Експортувати назву файлу"
msgid "Export footer formula"
msgstr "Експортувати підсумкову формулу"
#: rxdconst.sexporthidezerovalues
#, fuzzy
msgctxt "rxdconst.sexporthidezerovalues"
msgid "Hide zero values"
msgstr "Ховати нульові значення"
#: rxdconst.sexportimages
msgid "Export images"
msgstr "Експортувати зображення"
@ -256,6 +262,7 @@ msgid "Global"
msgstr "Загальний"
#: rxdconst.shidezerovalues
msgctxt "rxdconst.shidezerovalues"
msgid "Hide zero values"
msgstr "Ховати нульові значення"

View File

@ -44,7 +44,8 @@ type
ressExportFooter,
ressExportFormula,
ressOverwriteExisting,
ressExportSelectedRows
ressExportSelectedRows,
ressHideZeroValues
);
TRxDBGridExportSpreadSheetOptions = set of TRxDBGridExportSpreadSheetOption;
@ -153,13 +154,22 @@ begin
FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S)
else
if C.Field.DataType in [ftCurrency] then
FWorksheet.WriteCurrency(FCurRow, FCurCol, C.Field.AsCurrency, nfCurrency, '')
begin
if (C.Field.AsCurrency <> 0) or (not (ressHideZeroValues in FOptions)) then
FWorksheet.WriteCurrency(FCurRow, FCurCol, C.Field.AsCurrency, nfCurrency, '')
end
else
if C.Field.DataType in IntegerDataTypes then
FWorksheet.WriteNumber(FCurRow, FCurCol, C.Field.AsInteger, nfFixed, 0)
begin
if (C.Field.AsInteger <> 0) or (not (ressHideZeroValues in FOptions)) then
FWorksheet.WriteNumber(FCurRow, FCurCol, C.Field.AsInteger, nfFixed, 0)
end
else
if C.Field.DataType in NumericDataTypes then
FWorksheet.WriteNumber(FCurRow, FCurCol, C.Field.AsFloat, nfFixed, 2)
begin
if (C.Field.AsFloat <> 0) or (not (ressHideZeroValues in FOptions)) then
FWorksheet.WriteNumber(FCurRow, FCurCol, C.Field.AsFloat, nfFixed, 2)
end
else
FWorksheet.WriteUTF8Text(FCurRow, FCurCol, S);
end;
@ -532,6 +542,8 @@ begin
F.cbExportFormula.Checked:=ressExportFormula in FOptions;
F.cbExportSelectedRows.Checked:=ressExportSelectedRows in FOptions;
F.cbExportSelectedRows.Enabled:=(dgMultiselect in RxDBGrid.Options) and (RxDBGrid.SelectedRows.Count > 0);
F.cbHideZeroValues.Checked:=ressHideZeroValues in FOptions;
F.edtPageName.Text:=FPageName;
@ -555,6 +567,8 @@ begin
FOptions :=FOptions + [ressExportFormula];
if F.cbExportSelectedRows.Enabled and F.cbExportSelectedRows.Checked then
FOptions :=FOptions + [ressExportSelectedRows];
if F.cbHideZeroValues.Checked then
FOptions:=FOptions + [ressHideZeroValues];
end;
F.Free;
end;

View File

@ -1,21 +1,21 @@
object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsForm
Left = 732
Left = 483
Height = 294
Top = 338
Top = 235
Width = 548
Caption = 'Export params'
ClientHeight = 294
ClientWidth = 548
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.7'
LCLVersion = '1.9.0.0'
object Label1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 6
Height = 20
Height = 17
Top = 6
Width = 105
Width = 95
BorderSpacing.Around = 6
Caption = 'Export file name'
FocusControl = FileNameEdit1
@ -28,8 +28,8 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 12
Height = 37
Top = 32
Height = 34
Top = 29
Width = 530
Filter = 'All files (*.*)|*.*|LibreOffice/OpenOffice (*.ods)|*.ods|Excel 97-2003|*.xls|Excel 2007-2013|*.xlsx'
FilterIndex = 0
@ -44,12 +44,12 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
end
object Label3: TLabel
AnchorSideLeft.Control = Label4
AnchorSideTop.Control = cbOverwriteExisting
AnchorSideTop.Control = cbHideZeroValues
AnchorSideTop.Side = asrBottom
Left = 280
Height = 20
Top = 135
Width = 71
Height = 17
Top = 156
Width = 62
BorderSpacing.Around = 6
Caption = 'Page name'
FocusControl = edtPageName
@ -62,8 +62,8 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 286
Height = 37
Top = 161
Height = 34
Top = 179
Width = 256
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
@ -74,9 +74,9 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
AnchorSideTop.Control = cbExportColumnHeader
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 135
Width = 162
Height = 23
Top = 127
Width = 152
BorderSpacing.Around = 6
Caption = 'Export column footer'
TabOrder = 3
@ -86,9 +86,9 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
AnchorSideTop.Control = FileNameEdit1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 75
Width = 141
Height = 23
Top = 69
Width = 131
BorderSpacing.Around = 6
Caption = 'Open after export'
TabOrder = 1
@ -114,9 +114,9 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
AnchorSideTop.Control = cbOpenAfterExport
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 105
Width = 167
Height = 23
Top = 98
Width = 153
BorderSpacing.Around = 6
Caption = 'Export column header'
TabOrder = 2
@ -126,9 +126,9 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
AnchorSideTop.Control = cbExportColumnFooter
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 165
Width = 138
Height = 23
Top = 156
Width = 127
BorderSpacing.Around = 6
Caption = 'Export cell colors'
TabOrder = 4
@ -148,9 +148,9 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
AnchorSideTop.Control = cbExportFormula
AnchorSideTop.Side = asrBottom
Left = 280
Height = 24
Top = 105
Width = 168
Height = 23
Top = 98
Width = 154
BorderSpacing.Around = 6
Caption = 'Overwrite existing file'
TabOrder = 6
@ -160,9 +160,9 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
AnchorSideTop.Control = FileNameEdit1
AnchorSideTop.Side = asrBottom
Left = 280
Height = 24
Top = 75
Width = 121
Height = 23
Top = 69
Width = 113
BorderSpacing.Around = 6
Caption = 'Export formula'
TabOrder = 5
@ -172,11 +172,23 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
AnchorSideTop.Control = cbExportCellColors
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 195
Width = 163
Height = 23
Top = 185
Width = 149
BorderSpacing.Around = 6
Caption = 'Export selected rows'
TabOrder = 9
end
object cbHideZeroValues: TCheckBox
AnchorSideLeft.Control = Label4
AnchorSideTop.Control = cbOverwriteExisting
AnchorSideTop.Side = asrBottom
Left = 280
Height = 23
Top = 127
Width = 122
BorderSpacing.Around = 6
Caption = 'Hide zero values'
TabOrder = 10
end
end

View File

@ -52,6 +52,7 @@ type
cbExportColumnHeader: TCheckBox;
cbExportCellColors: TCheckBox;
cbOverwriteExisting: TCheckBox;
cbHideZeroValues: TCheckBox;
edtPageName: TEdit;
FileNameEdit1: TFileNameEdit;
Label1: TLabel;
@ -83,6 +84,7 @@ begin
cbOverwriteExisting.Caption:=sOverwriteExisting;
cbExportFormula.Caption:=sExportFormula;
cbExportSelectedRows.Caption:=sExportSelectedRows;
cbHideZeroValues.Caption:=sExportHideZeroValues;
end;
end.

View File

@ -186,6 +186,7 @@ resourcestring
sExportFormula = 'Export footer formula';
sExportImages = 'Export images';
sExportSelectedRows = 'Export only selected rows';
sExportHideZeroValues = 'Hide zero values';
sOverwriteExisting = 'Overwrite existing';
sShowColumnHeaderOnAllPage = 'Show column header on all pages';
sPageMargins = 'Page margins';