fpspreadsheet: Add more format selection items to fpsgrid demo.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3083 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-05-23 15:45:07 +00:00
parent 49e99a74b5
commit 08d3a8a137
6 changed files with 2365 additions and 2022 deletions

View File

@ -107,7 +107,7 @@
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="60">
<Units Count="61">
<Unit0>
<Filename Value="fpsgrid.lpr"/>
<IsPartOfProject Value="True"/>
@ -128,8 +128,8 @@
<UnitName Value="mainform"/>
<EditorIndex Value="1"/>
<WindowIndex Value="0"/>
<TopLine Value="395"/>
<CursorPos X="16" Y="400"/>
<TopLine Value="818"/>
<CursorPos X="3" Y="825"/>
<UsageCount Value="200"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
@ -137,10 +137,10 @@
<Unit2>
<Filename Value="..\..\fpspreadsheet.pas"/>
<UnitName Value="fpspreadsheet"/>
<EditorIndex Value="5"/>
<EditorIndex Value="6"/>
<WindowIndex Value="0"/>
<TopLine Value="3041"/>
<CursorPos X="65" Y="3072"/>
<TopLine Value="145"/>
<CursorPos X="38" Y="163"/>
<UsageCount Value="100"/>
<Loaded Value="True"/>
</Unit2>
@ -148,10 +148,10 @@
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<UnitName Value="fpspreadsheetgrid"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="6"/>
<EditorIndex Value="7"/>
<WindowIndex Value="0"/>
<TopLine Value="912"/>
<CursorPos X="9" Y="920"/>
<TopLine Value="98"/>
<CursorPos X="1" Y="108"/>
<UsageCount Value="100"/>
<Loaded Value="True"/>
</Unit3>
@ -229,11 +229,11 @@
<Unit13>
<Filename Value="..\..\fpsutils.pas"/>
<UnitName Value="fpsutils"/>
<EditorIndex Value="2"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="1044"/>
<CursorPos X="32" Y="1050"/>
<UsageCount Value="66"/>
<TopLine Value="44"/>
<CursorPos X="14" Y="70"/>
<UsageCount Value="68"/>
<Loaded Value="True"/>
</Unit13>
<Unit14>
@ -246,30 +246,26 @@
<Unit15>
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
<UnitName Value="Graphics"/>
<EditorIndex Value="7"/>
<WindowIndex Value="0"/>
<TopLine Value="86"/>
<CursorPos X="5" Y="104"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
</Unit15>
<Unit16>
<Filename Value="d:\lazarus-svn\fpc\2.6.2\source\rtl\objpas\classes\classesh.inc"/>
<EditorIndex Value="8"/>
<WindowIndex Value="0"/>
<TopLine Value="76"/>
<CursorPos X="3" Y="95"/>
<UsageCount Value="13"/>
<Loaded Value="True"/>
</Unit16>
<Unit17>
<Filename Value="..\..\xlsbiff8.pas"/>
<UnitName Value="xlsbiff8"/>
<EditorIndex Value="3"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="1920"/>
<CursorPos X="21" Y="1924"/>
<UsageCount Value="96"/>
<UsageCount Value="98"/>
<Loaded Value="True"/>
</Unit17>
<Unit18>
@ -290,11 +286,11 @@
<Unit20>
<Filename Value="..\..\xlscommon.pas"/>
<UnitName Value="xlscommon"/>
<EditorIndex Value="4"/>
<EditorIndex Value="5"/>
<WindowIndex Value="0"/>
<TopLine Value="650"/>
<CursorPos X="24" Y="662"/>
<UsageCount Value="92"/>
<UsageCount Value="94"/>
<Bookmarks Count="1">
<Item0 X="41" Y="1209" ID="1"/>
</Bookmarks>
@ -593,127 +589,136 @@
<CursorPos X="5" Y="43"/>
<UsageCount Value="12"/>
</Unit59>
<Unit60>
<Filename Value="C:\development\fpc\rtl\inc\astrings.inc"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="104"/>
<CursorPos X="1" Y="120"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit60>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="1066" Column="1" TopLine="1047"/>
<Filename Value="mainform.pas"/>
<Caret Line="800" Column="1" TopLine="781"/>
</Position1>
<Position2>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="1067" Column="1" TopLine="1047"/>
<Filename Value="mainform.pas"/>
<Caret Line="799" Column="75" TopLine="781"/>
</Position2>
<Position3>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="1068" Column="1" TopLine="1047"/>
<Filename Value="mainform.pas"/>
<Caret Line="796" Column="1" TopLine="781"/>
</Position3>
<Position4>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="1069" Column="10" TopLine="1047"/>
<Filename Value="mainform.pas"/>
<Caret Line="797" Column="1" TopLine="781"/>
</Position4>
<Position5>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="1043" Column="1" TopLine="1030"/>
<Filename Value="mainform.pas"/>
<Caret Line="798" Column="1" TopLine="781"/>
</Position5>
<Position6>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="1066" Column="1" TopLine="1047"/>
<Filename Value="mainform.pas"/>
<Caret Line="799" Column="1" TopLine="781"/>
</Position6>
<Position7>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="1067" Column="1" TopLine="1047"/>
<Filename Value="mainform.pas"/>
<Caret Line="802" Column="1" TopLine="781"/>
</Position7>
<Position8>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="1068" Column="1" TopLine="1047"/>
<Filename Value="mainform.pas"/>
<Caret Line="803" Column="1" TopLine="788"/>
</Position8>
<Position9>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="1069" Column="1" TopLine="1053"/>
<Filename Value="mainform.pas"/>
<Caret Line="816" Column="29" TopLine="788"/>
</Position9>
<Position10>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="1070" Column="1" TopLine="1053"/>
<Filename Value="mainform.pas"/>
<Caret Line="798" Column="1" TopLine="788"/>
</Position10>
<Position11>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="1072" Column="1" TopLine="1053"/>
<Filename Value="mainform.pas"/>
<Caret Line="799" Column="1" TopLine="788"/>
</Position11>
<Position12>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="1086" Column="5" TopLine="1053"/>
<Filename Value="mainform.pas"/>
<Caret Line="802" Column="1" TopLine="788"/>
</Position12>
<Position13>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="882" Column="16" TopLine="882"/>
<Filename Value="mainform.pas"/>
<Caret Line="803" Column="1" TopLine="788"/>
</Position13>
<Position14>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="174" Column="21" TopLine="174"/>
<Filename Value="mainform.pas"/>
<Caret Line="804" Column="1" TopLine="788"/>
</Position14>
<Position15>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
<Filename Value="mainform.pas"/>
<Caret Line="806" Column="19" TopLine="781"/>
</Position15>
<Position16>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="147" Column="16" TopLine="116"/>
<Filename Value="mainform.pas"/>
<Caret Line="799" Column="1" TopLine="781"/>
</Position16>
<Position17>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="193" Column="13" TopLine="162"/>
<Filename Value="mainform.pas"/>
<Caret Line="808" Column="1" TopLine="782"/>
</Position17>
<Position18>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="311" Column="29" TopLine="280"/>
<Filename Value="mainform.pas"/>
<Caret Line="799" Column="1" TopLine="782"/>
</Position18>
<Position19>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="439" Column="73" TopLine="410"/>
<Filename Value="mainform.pas"/>
<Caret Line="800" Column="1" TopLine="782"/>
</Position19>
<Position20>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="900" Column="47" TopLine="869"/>
<Filename Value="mainform.pas"/>
<Caret Line="803" Column="1" TopLine="782"/>
</Position20>
<Position21>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1872" Column="81" TopLine="1841"/>
<Filename Value="mainform.pas"/>
<Caret Line="804" Column="1" TopLine="782"/>
</Position21>
<Position22>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1877" Column="76" TopLine="1846"/>
<Filename Value="mainform.pas"/>
<Caret Line="805" Column="1" TopLine="782"/>
</Position22>
<Position23>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1878" Column="18" TopLine="1847"/>
<Filename Value="mainform.pas"/>
<Caret Line="806" Column="1" TopLine="782"/>
</Position23>
<Position24>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="3071" Column="19" TopLine="3040"/>
<Filename Value="mainform.pas"/>
<Caret Line="807" Column="1" TopLine="782"/>
</Position24>
<Position25>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="1030" Column="47" TopLine="1030"/>
<Filename Value="mainform.pas"/>
<Caret Line="808" Column="1" TopLine="782"/>
</Position25>
<Position26>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
<Filename Value="mainform.pas"/>
<Caret Line="806" Column="50" TopLine="784"/>
</Position26>
<Position27>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="65" Column="62" TopLine="36"/>
<Filename Value="mainform.pas"/>
<Caret Line="787" Column="104" TopLine="784"/>
</Position27>
<Position28>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="1788" Column="3" TopLine="1788"/>
<Filename Value="mainform.pas"/>
<Caret Line="243" Column="29" TopLine="227"/>
</Position28>
<Position29>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
<Filename Value="mainform.pas"/>
<Caret Line="714" Column="35" TopLine="696"/>
</Position29>
<Position30>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="886" Column="40" TopLine="855"/>
<Filename Value="mainform.pas"/>
<Caret Line="825" Column="3" TopLine="818"/>
</Position30>
</JumpHistory>
</ProjectOptions>

View File

@ -4,9 +4,9 @@ object Form1: TForm1
Top = 193
Width = 884
Caption = 'fpsGrid'
ClientHeight = 629
ClientHeight = 624
ClientWidth = 884
Menu = MainMenu1
Menu = MainMenu
OnActivate = FormActivate
OnCreate = FormCreate
ShowHint = True
@ -14,7 +14,7 @@ object Form1: TForm1
object Panel1: TPanel
Left = 0
Height = 76
Top = 553
Top = 548
Width = 884
Align = alBottom
BevelOuter = bvNone
@ -23,9 +23,9 @@ object Form1: TForm1
TabOrder = 0
object CbShowHeaders: TCheckBox
Left = 8
Height = 19
Height = 24
Top = 11
Width = 93
Width = 116
Caption = 'Show headers'
Checked = True
OnClick = CbShowHeadersClick
@ -34,9 +34,9 @@ object Form1: TForm1
end
object CbShowGridLines: TCheckBox
Left = 8
Height = 19
Height = 24
Top = 36
Width = 100
Width = 125
Caption = 'Show grid lines'
Checked = True
OnClick = CbShowGridLinesClick
@ -45,7 +45,7 @@ object Form1: TForm1
end
object EdFrozenCols: TSpinEdit
Left = 238
Height = 23
Height = 28
Top = 8
Width = 52
OnChange = EdFrozenColsChange
@ -53,7 +53,7 @@ object Form1: TForm1
end
object EdFrozenRows: TSpinEdit
Left = 238
Height = 23
Height = 28
Top = 39
Width = 52
OnChange = EdFrozenRowsChange
@ -61,18 +61,18 @@ object Form1: TForm1
end
object Label1: TLabel
Left = 152
Height = 15
Height = 20
Top = 13
Width = 62
Width = 77
Caption = 'Frozen cols:'
FocusControl = EdFrozenCols
ParentColor = False
end
object Label2: TLabel
Left = 153
Height = 15
Height = 20
Top = 40
Width = 66
Width = 82
Caption = 'Frozen rows:'
FocusControl = EdFrozenRows
ParentColor = False
@ -80,7 +80,7 @@ object Form1: TForm1
end
object PageControl1: TPageControl
Left = 0
Height = 500
Height = 495
Top = 53
Width = 884
ActivePage = TabSheet1
@ -90,11 +90,11 @@ object Form1: TForm1
OnChange = PageControl1Change
object TabSheet1: TTabSheet
Caption = 'Sheet1'
ClientHeight = 472
ClientHeight = 462
ClientWidth = 876
object sWorksheetGrid1: TsWorksheetGrid
object WorksheetGrid: TsWorksheetGrid
Left = 0
Height = 472
Height = 462
Top = 0
Width = 876
FrozenCols = 0
@ -107,9 +107,9 @@ object Form1: TForm1
RowCount = 2
TabOrder = 0
TitleStyle = tsNative
OnSelection = sWorksheetGrid1Selection
OnSelection = WorksheetGridSelection
ColWidths = (
42
56
64
)
end
@ -123,7 +123,7 @@ object Form1: TForm1
ButtonHeight = 24
Caption = 'ToolBar1'
EdgeBorders = []
Images = ImageList1
Images = ImageList
TabOrder = 2
object ToolButton1: TToolButton
Left = 1
@ -167,7 +167,7 @@ object Form1: TForm1
Width = 884
ButtonHeight = 23
Caption = 'FormatToolBar'
Images = ImageList1
Images = ImageList
TabOrder = 3
object ToolButton10: TToolButton
Left = 324
@ -187,19 +187,19 @@ object Form1: TForm1
end
object FontComboBox: TComboBox
Left = 52
Height = 23
Height = 28
Top = 2
Width = 127
ItemHeight = 15
ItemHeight = 20
OnSelect = FontComboBoxSelect
TabOrder = 0
end
object FontSizeComboBox: TComboBox
Left = 179
Height = 23
Height = 28
Top = 2
Width = 48
ItemHeight = 15
ItemHeight = 20
Items.Strings = (
'8'
'9'
@ -332,24 +332,24 @@ object Form1: TForm1
Action = AcCopyFormat
end
end
object OpenDialog1: TOpenDialog
object OpenDialog: TOpenDialog
DefaultExt = '.xls'
Filter = 'Excel spreadsheet (*.xls)|*.xls|Excel XML spreadsheet (*.xlsx)|*.xlxs|LibreOffice/OpenOffice spreadsheet (*.ods)|*.ods|Wikitable (pipes) (.wikitable_pipes)|.wikitable_pipes|All files (*.*)|*.*'
Options = [ofExtensionDifferent, ofEnableSizing, ofViewDetail]
left = 64
top = 176
left = 184
top = 200
end
object SaveDialog1: TSaveDialog
object SaveDialog: TSaveDialog
DefaultExt = '.xls'
Filter = 'Excel spreadsheet (*.xls)|*.xls|Excel XML spreadsheet (*.xlsx)|*.xlsx|LibreOffice/OpenOffice spreadsheet (*.ods)|*.ods|Wikitable (wikimedia) (.wikitable_wikimedia)|*.wikitable_wikimedia'
Options = [ofOverwritePrompt, ofExtensionDifferent, ofEnableSizing, ofViewDetail]
left = 176
top = 176
left = 184
top = 264
end
object MainMenu1: TMainMenu
Images = ImageList1
left = 288
top = 64
object MainMenu: TMainMenu
Images = ImageList
left = 384
top = 200
object mnuFile: TMenuItem
Caption = '&File'
object mnuOpen: TMenuItem
@ -872,9 +872,9 @@ object Form1: TForm1
end
end
end
object ImageList1: TImageList
left = 176
top = 120
object ImageList: TImageList
left = 272
top = 264
Bitmap = {
4C69220000001000000010000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00EAC39DFFE6BF96FFE4BB92FFE4BB92FFD1A06CF5D09E6DF6CC96
@ -1967,10 +1967,10 @@ object Form1: TForm1
FF00FFFFFF00FFFFFF00FFFFFF00
}
end
object ActionList1: TActionList
Images = ImageList1
left = 176
top = 64
object ActionList: TActionList
Images = ImageList
left = 272
top = 200
object AcOpen: TAction
Caption = 'Open...'
ImageIndex = 0
@ -2230,7 +2230,7 @@ object Form1: TForm1
OnExecute = AcTextRotationExecute
end
object AcNFGeneral: TAction
Tag = 150
Tag = 1000
Category = 'Format'
AutoCheck = True
Caption = 'General'
@ -2238,7 +2238,7 @@ object Form1: TForm1
OnExecute = AcNumFormatExecute
end
object AcNFFixed: TAction
Tag = 151
Tag = 1010
Category = 'Format'
AutoCheck = True
Caption = 'Fixed'
@ -2246,7 +2246,7 @@ object Form1: TForm1
OnExecute = AcNumFormatExecute
end
object AcNFFixedTh: TAction
Tag = 152
Tag = 1020
Category = 'Format'
AutoCheck = True
Caption = 'Fixed w/thousand separator'
@ -2254,26 +2254,138 @@ object Form1: TForm1
OnExecute = AcNumFormatExecute
end
object AcNFExp: TAction
Tag = 153
Tag = 1030
Category = 'Format'
AutoCheck = True
Caption = 'Exponential'
OnExecute = AcNumFormatExecute
end
object AcNFSci: TAction
Tag = 154
Tag = 1040
Category = 'Format'
AutoCheck = True
Caption = 'Scientific'
OnExecute = AcNumFormatExecute
end
object AcNFPercentage: TAction
Tag = 155
Tag = 1050
Category = 'Format'
AutoCheck = True
Caption = 'Percentage'
OnExecute = AcNumFormatExecute
end
object AcNFCurrency: TAction
Tag = 1060
Category = 'Format'
AutoCheck = True
Caption = 'Currency'
OnExecute = AcNumFormatExecute
end
object AcNFCurrencyRed: TAction
Tag = 1070
Category = 'Format'
AutoCheck = True
Caption = 'Currency (negative values in red)'
OnExecute = AcNumFormatExecute
end
object AcNFAccounting: TAction
Tag = 1080
Category = 'Format'
AutoCheck = True
Caption = 'Accounting'
OnExecute = AcNumFormatExecute
end
object AcNFAccountingRed: TAction
Tag = 1090
Category = 'Format'
AutoCheck = True
Caption = 'Accounting (negative values in red)'
OnExecute = AcNumFormatExecute
end
object AcNFShortDateTime: TAction
Tag = 1100
Category = 'Format'
AutoCheck = True
Caption = 'Date + time'
OnExecute = AcNumFormatExecute
end
object AcNFShortDate: TAction
Tag = 1120
Category = 'Format'
AutoCheck = True
Caption = 'Short date'
OnExecute = AcNumFormatExecute
end
object AcNFFmtDateTimeDM: TAction
Tag = 1111
Category = 'Format'
AutoCheck = True
Caption = 'Day + month'
OnExecute = AcNumFormatExecute
end
object AcNFFmtDateTimeMY: TAction
Tag = 1112
Category = 'Format'
AutoCheck = True
Caption = 'Month + year'
OnExecute = AcNumFormatExecute
end
object AcNFLongDate: TAction
Tag = 1130
Category = 'Format'
AutoCheck = True
Caption = 'Long date'
OnExecute = AcNumFormatExecute
end
object AcNFShortTime: TAction
Tag = 1140
Category = 'Format'
AutoCheck = True
Caption = 'Short time'
OnExecute = AcNumFormatExecute
end
object AcNFLongTime: TAction
Tag = 1150
Category = 'Format'
AutoCheck = True
Caption = 'Long time'
OnExecute = AcNumFormatExecute
end
object AcNFShortTimeAM: TAction
Tag = 1160
Category = 'Format'
AutoCheck = True
Caption = 'Short time AM/PM'
OnExecute = AcNumFormatExecute
end
object AcNFLongTimeAM: TAction
Tag = 1170
Category = 'Format'
AutoCheck = True
Caption = 'Long time AM/PM'
OnExecute = AcNumFormatExecute
end
object AcNFFmtDateTimeMS: TAction
Tag = 1113
Category = 'Format'
AutoCheck = True
Caption = 'Minutes + seconds'
OnExecute = AcNumFormatExecute
end
object AcNFFmtDateTimeMSZ: TAction
Tag = 1114
Category = 'Format'
AutoCheck = True
Caption = 'Minutes + seconds + milliseconds'
OnExecute = AcNumFormatExecute
end
object AcNFTimeInterval: TAction
Tag = 1180
Category = 'Format'
AutoCheck = True
Caption = 'Time interval'
OnExecute = AcNumFormatExecute
end
object AcIncDecimals: TAction
Category = 'Format'
Caption = 'AcIncDecimals'
@ -2296,16 +2408,16 @@ object Form1: TForm1
OnExecute = AcCopyFormatExecute
end
end
object FontDialog1: TFontDialog
object FontDialog: TFontDialog
MinFontSize = 0
MaxFontSize = 0
left = 176
top = 234
left = 184
top = 328
end
object BordersPopupMenu: TPopupMenu
Images = ImageList1
left = 288
top = 120
Images = ImageList
left = 384
top = 264
object MenuItem20: TMenuItem
Action = AcBorderNone
Bitmap.Data = {
@ -2911,12 +3023,15 @@ object Form1: TForm1
end
end
object NumFormatPopupMenu: TPopupMenu
left = 290
top = 179
left = 384
top = 328
object MnuNFGeneral: TMenuItem
Action = AcNFGeneral
AutoCheck = True
end
object MenuItem41: TMenuItem
Caption = '-'
end
object MnuNFFixed: TMenuItem
Action = AcNFFixed
AutoCheck = True
@ -2937,5 +3052,84 @@ object Form1: TForm1
Action = AcNFSci
AutoCheck = True
end
object MenuItem39: TMenuItem
Caption = '-'
end
object MnuCurrency: TMenuItem
Action = AcNFCurrency
AutoCheck = True
end
object MnuCurrencyRed: TMenuItem
Action = AcNFCurrencyRed
AutoCheck = True
end
object MnuAccounting: TMenuItem
Action = AcNFAccounting
AutoCheck = True
end
object MnuAccountingRed: TMenuItem
Action = AcNFAccountingRed
AutoCheck = True
end
object MenuItem40: TMenuItem
Caption = '-'
end
object MnuShortDateTime: TMenuItem
Action = AcNFShortDateTime
AutoCheck = True
end
object MenuItem42: TMenuItem
Caption = '-'
end
object MnuLongDate: TMenuItem
Action = AcNFLongDate
AutoCheck = True
end
object MnuShortDate: TMenuItem
Action = AcNFShortDate
AutoCheck = True
end
object MnuFmtDateTimeDM: TMenuItem
Action = AcNFFmtDateTimeDM
AutoCheck = True
end
object MnuFmtDateTimeMY: TMenuItem
Action = AcNFFmtDateTimeMY
AutoCheck = True
end
object MenuItem43: TMenuItem
Caption = '-'
end
object MnuLongTime: TMenuItem
Action = AcNFLongTime
AutoCheck = True
end
object MnuLongTimeAM: TMenuItem
Action = AcNFLongTimeAM
AutoCheck = True
end
object MnuShortTime: TMenuItem
Action = AcNFShortTime
AutoCheck = True
end
object MnuShortTimeAM: TMenuItem
Action = AcNFShortTimeAM
AutoCheck = True
end
object MenuItem45: TMenuItem
Action = AcNFFmtDateTimeMS
AutoCheck = True
end
object MnuFmtDateTimeMSZ: TMenuItem
Action = AcNFFmtDateTimeMSZ
AutoCheck = True
end
object MenuItem44: TMenuItem
Caption = '-'
end
object MnuTimeInterval: TMenuItem
Action = AcNFTimeInterval
AutoCheck = True
end
end
end

File diff suppressed because it is too large Load Diff

View File

@ -55,23 +55,39 @@ type
AcNFExp: TAction;
AcNFSci: TAction;
AcCopyFormat: TAction;
AcNFCurrency: TAction;
AcNFCurrencyRed: TAction;
AcNFAccounting: TAction;
AcNFAccountingRed: TAction;
AcNFShortDateTime: TAction;
AcNFShortDate: TAction;
AcNFLongDate: TAction;
AcNFShortTime: TAction;
AcNFLongTime: TAction;
AcNFShortTimeAM: TAction;
AcNFLongTimeAM: TAction;
AcNFTimeInterval: TAction;
AcNFFmtDateTimeDM: TAction;
AcNFFmtDateTimeMY: TAction;
AcNFFmtDateTimeMS: TAction;
AcNFFmtDateTimeMSZ: TAction;
AcWordwrap: TAction;
AcVAlignDefault: TAction;
AcVAlignTop: TAction;
AcVAlignCenter: TAction;
AcVAlignBottom: TAction;
ActionList1: TActionList;
ActionList: TActionList;
CbShowHeaders: TCheckBox;
CbShowGridLines: TCheckBox;
CbBackgroundColor: TColorBox;
FontComboBox: TComboBox;
EdFrozenRows: TSpinEdit;
FontDialog1: TFontDialog;
FontDialog: TFontDialog;
FontSizeComboBox: TComboBox;
ImageList1: TImageList;
ImageList: TImageList;
Label1: TLabel;
Label2: TLabel;
MainMenu1: TMainMenu;
MainMenu: TMainMenu;
MenuItem1: TMenuItem;
MenuItem10: TMenuItem;
MenuItem11: TMenuItem;
@ -103,6 +119,28 @@ type
MenuItem36: TMenuItem;
MenuItem37: TMenuItem;
MenuItem38: TMenuItem;
MenuItem39: TMenuItem;
MenuItem40: TMenuItem;
MenuItem41: TMenuItem;
MenuItem42: TMenuItem;
MenuItem43: TMenuItem;
MenuItem44: TMenuItem;
MenuItem45: TMenuItem;
MnuFmtDateTimeMSZ: TMenuItem;
MnuTimeInterval: TMenuItem;
MnuShortTimeAM: TMenuItem;
MnuLongTimeAM: TMenuItem;
MnuFmtDateTimeMY: TMenuItem;
MnuFmtDateTimeDM: TMenuItem;
MnuShortTime: TMenuItem;
MnuShortDate: TMenuItem;
MnuLongTime: TMenuItem;
MnuLongDate: TMenuItem;
MnuShortDateTime: TMenuItem;
MnuAccountingRed: TMenuItem;
MnuAccounting: TMenuItem;
MnuCurrencyRed: TMenuItem;
MnuCurrency: TMenuItem;
MnuNumberFormat: TMenuItem;
MnuNFFixed: TMenuItem;
MnuNFFixedTh: TMenuItem;
@ -133,14 +171,14 @@ type
mnuOpen: TMenuItem;
mnuQuit: TMenuItem;
mnuSaveAs: TMenuItem;
OpenDialog1: TOpenDialog;
OpenDialog: TOpenDialog;
PageControl1: TPageControl;
Panel1: TPanel;
BordersPopupMenu: TPopupMenu;
NumFormatPopupMenu: TPopupMenu;
SaveDialog1: TSaveDialog;
SaveDialog: TSaveDialog;
EdFrozenCols: TSpinEdit;
sWorksheetGrid1: TsWorksheetGrid;
WorksheetGrid: TsWorksheetGrid;
TabSheet1: TTabSheet;
ToolBar1: TToolBar;
FormatToolBar: TToolBar;
@ -195,7 +233,7 @@ type
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure PageControl1Change(Sender: TObject);
procedure sWorksheetGrid1Selection(Sender: TObject; aCol, aRow: Integer);
procedure WorksheetGridSelection(Sender: TObject; aCol, aRow: Integer);
private
{ private declarations }
FCopiedFormat: TCell;
@ -220,13 +258,13 @@ var
implementation
uses
fpcanvas;
fpcanvas, fpsutils;
const
HORALIGN_TAG = 100;
VERTALIGN_TAG = 110;
TEXTROT_TAG = 130;
NUMFMT_TAG = 150; // needs 20
NUMFMT_TAG = 1000; // differnce 10 per format item
LEFT_BORDER_THIN = $0001;
LEFT_BORDER_THICK = $0002;
@ -252,9 +290,9 @@ const
procedure TForm1.AcEditExecute(Sender: TObject);
begin
if AcEdit.Checked then
sWorksheetGrid1.Options := sWorksheetGrid1.Options + [goEditing]
WorksheetGrid.Options := WorksheetGrid.Options + [goEditing]
else
sWorksheetGrid1.Options := sWorksheetGrid1.Options - [goEditing];
WorksheetGrid.Options := WorksheetGrid.Options - [goEditing];
end;
procedure TForm1.AcBorderExecute(Sender: TObject);
@ -267,7 +305,7 @@ var
begin
bs.Color := scBlack;
with sWorksheetGrid1 do begin
with WorksheetGrid do begin
TbBorders.Action := TAction(Sender);
BeginUpdate;
@ -346,7 +384,7 @@ var
cell: PCell;
r, c: Cardinal;
begin
with sWorksheetGrid1 do begin
with WorksheetGrid do begin
if Workbook = nil then
exit;
@ -363,12 +401,12 @@ end;
{ Changes the font of the selected cell by calling a standard font dialog. }
procedure TForm1.AcFontExecute(Sender: TObject);
begin
with sWorksheetGrid1 do begin
with WorksheetGrid do begin
if Workbook = nil then
exit;
FontDialog1.Font := CellFonts[Selection];
if FontDialog1.Execute then
CellFonts[Selection] := FontDialog1.Font;
FontDialog.Font := CellFonts[Selection];
if FontDialog.Execute then
CellFonts[Selection] := FontDialog.Font;
end;
end;
@ -376,7 +414,7 @@ procedure TForm1.AcFontStyleExecute(Sender: TObject);
var
style: TsFontstyles;
begin
with sWorksheetGrid1 do begin
with WorksheetGrid do begin
if Workbook = nil then
exit;
style := [];
@ -396,7 +434,7 @@ begin
hor_align := TsHorAlignment(TAction(Sender).Tag - HORALIGN_TAG)
else
hor_align := haDefault;
with sWorksheetGrid1 do HorAlignments[Selection] := hor_align;
with WorksheetGrid do HorAlignments[Selection] := hor_align;
UpdateHorAlignmentActions;
end;
@ -405,7 +443,7 @@ var
cell: PCell;
decs: Byte;
begin
with sWorksheetGrid1 do begin
with WorksheetGrid do begin
if Workbook = nil then
exit;
cell := Worksheet.FindCell(GetWorksheetRow(Row), GetWorksheetCol(Col));
@ -420,22 +458,42 @@ begin
end;
procedure TForm1.AcNumFormatExecute(Sender: TObject);
const
DATETIME_FMT: array[0..4] of string = ('', 'dm', 'my', 'ms', 'msz');
var
nf: TsNumberFormat;
c, r: Cardinal;
cell: PCell;
fmt: String;
begin
if sWorksheetGrid1.Worksheet = nil then
if WorksheetGrid.Worksheet = nil then
exit;
if TAction(Sender).Checked then
nf := TsNumberFormat(TAction(Sender).Tag - NUMFMT_TAG)
nf := TsNumberFormat((TAction(Sender).Tag - NUMFMT_TAG) div 10)
else
nf := nfGeneral;
with sWorksheetGrid1 do begin
if nf = nfFmtDateTime then
fmt := DATETIME_FMT[TAction(Sender).Tag mod 10]
else
fmt := '';
with WorksheetGrid do begin
c := GetWorksheetCol(Col);
r := GetWorksheetRow(Row);
Worksheet.WriteNumberFormat(r, c, nf);
cell := Worksheet.GetCell(r, c);
if IsDateTimeFormat(nf) then begin
if IsDateTimeFormat(cell^.NumberFormat) then
Worksheet.WriteDateTime(cell, cell^.DateTimeValue, nf, fmt)
else
Worksheet.WriteDateTime(cell, cell^.NumberValue, nf, fmt);
end else begin
if IsDateTimeFormat(cell^.NumberFormat) then
Worksheet.WriteNumber(cell, cell^.DateTimeValue, nf, cell^.Decimals, cell^.CurrencySymbol)
else
Worksheet.WriteNumber(cell, cell^.NumberValue, nf, cell^.Decimals, cell^.CurrencySymbol);
end;
end;
UpdateNumFormatActions;
@ -449,7 +507,7 @@ begin
text_rot := TsTextRotation(TAction(Sender).Tag - TEXTROT_TAG)
else
text_rot := trHorizontal;
with sWorksheetGrid1 do TextRotations[Selection] := text_rot;
with WorksheetGrid do TextRotations[Selection] := text_rot;
UpdateTextRotationActions;
end;
@ -461,34 +519,34 @@ begin
vert_align := TsVertAlignment(TAction(Sender).Tag - VERTALIGN_TAG)
else
vert_align := vaDefault;
with sWorksheetGrid1 do VertAlignments[Selection] := vert_align;
with WorksheetGrid do VertAlignments[Selection] := vert_align;
UpdateVertAlignmentActions;
end;
procedure TForm1.AcWordwrapExecute(Sender: TObject);
begin
with sWorksheetGrid1 do Wordwraps[Selection] := TAction(Sender).Checked;
with WorksheetGrid do Wordwraps[Selection] := TAction(Sender).Checked;
end;
procedure TForm1.CbBackgroundColorSelect(Sender: TObject);
begin
with sWorksheetGrid1 do BackgroundColors[Selection] := CbBackgroundColor.ItemIndex;
with WorksheetGrid do BackgroundColors[Selection] := CbBackgroundColor.ItemIndex;
end;
procedure TForm1.CbShowHeadersClick(Sender: TObject);
begin
sWorksheetGrid1.ShowHeaders := CbShowHeaders.Checked;
WorksheetGrid.ShowHeaders := CbShowHeaders.Checked;
end;
procedure TForm1.CbShowGridLinesClick(Sender: TObject);
begin
sWorksheetGrid1.ShowGridLines := CbShowGridLines.Checked;
WorksheetGrid.ShowGridLines := CbShowGridLines.Checked;
end;
procedure TForm1.acOpenExecute(Sender: TObject);
begin
if OpenDialog1.Execute then
LoadFile(OpenDialog1.FileName);
if OpenDialog.Execute then
LoadFile(OpenDialog.FileName);
end;
procedure TForm1.acQuitExecute(Sender: TObject);
@ -499,11 +557,11 @@ end;
procedure TForm1.acSaveAsExecute(Sender: TObject);
// Saves sheet in grid to file, overwriting existing file
begin
if sWorksheetGrid1.Workbook = nil then
if WorksheetGrid.Workbook = nil then
exit;
if SaveDialog1.Execute then
sWorksheetGrid1.SaveToSpreadsheetFile(SaveDialog1.FileName);
if SaveDialog.Execute then
WorksheetGrid.SaveToSpreadsheetFile(SaveDialog.FileName);
end;
procedure TForm1.CbBackgroundColorGetColors(Sender: TCustomColorBox; Items: TStrings);
@ -514,10 +572,10 @@ var
rgb: TRGB absolute clr;
i: Integer;
begin
if sWorksheetGrid1.Workbook <> nil then begin
if WorksheetGrid.Workbook <> nil then begin
Items.Clear;
for i:=0 to sWorksheetGrid1.Workbook.GetPaletteSize-1 do begin
clr := sWorksheetGrid1.Workbook.GetPaletteColor(i);
for i:=0 to WorksheetGrid.Workbook.GetPaletteSize-1 do begin
clr := WorksheetGrid.Workbook.GetPaletteColor(i);
Items.AddObject(Format('Color %d: %.2x%.2x%.2x', [i, rgb.R, rgb.G, rgb.B]),
TObject(PtrInt(clr)));
end;
@ -526,12 +584,12 @@ end;
procedure TForm1.EdFrozenColsChange(Sender: TObject);
begin
sWorksheetGrid1.FrozenCols := EdFrozenCols.Value;
WorksheetGrid.FrozenCols := EdFrozenCols.Value;
end;
procedure TForm1.EdFrozenRowsChange(Sender: TObject);
begin
sWorksheetGrid1.FrozenRows := EdFrozenRows.Value;
WorksheetGrid.FrozenRows := EdFrozenRows.Value;
end;
procedure TForm1.FontComboBoxSelect(Sender: TObject);
@ -540,7 +598,7 @@ var
begin
fname := FontCombobox.Items[FontCombobox.ItemIndex];
if fname <> '' then
with sWorksheetGrid1 do CellFontNames[Selection] := fName;
with WorksheetGrid do CellFontNames[Selection] := fName;
end;
procedure TForm1.FontSizeComboBoxSelect(Sender: TObject);
@ -549,7 +607,7 @@ var
begin
sz := StrToInt(FontSizeCombobox.Items[FontSizeCombobox.ItemIndex]);
if sz > 0 then
with sWorksheetGrid1 do CellFontSizes[Selection] := sz;
with WorksheetGrid do CellFontSizes[Selection] := sz;
end;
procedure TForm1.FormActivate(Sender: TObject);
@ -592,25 +650,25 @@ var
i: Integer;
begin
// Load file
sWorksheetGrid1.LoadFromSpreadsheetFile(UTF8ToSys(AFileName));
WorksheetGrid.LoadFromSpreadsheetFile(UTF8ToSys(AFileName));
// Update user interface
Caption := Format('fpsGrid - %s (%s)', [
AFilename,
GetFileFormatName(sWorksheetGrid1.Workbook.FileFormat)
GetFileFormatName(WorksheetGrid.Workbook.FileFormat)
]);
CbShowGridLines.Checked := (soShowGridLines in sWorksheetGrid1.Worksheet.Options);
CbShowHeaders.Checked := (soShowHeaders in sWorksheetGrid1.Worksheet.Options);
EdFrozenCols.Value := sWorksheetGrid1.FrozenCols;
EdFrozenRows.Value := sWorksheetGrid1.FrozenRows;
CbShowGridLines.Checked := (soShowGridLines in WorksheetGrid.Worksheet.Options);
CbShowHeaders.Checked := (soShowHeaders in WorksheetGrid.Worksheet.Options);
EdFrozenCols.Value := WorksheetGrid.FrozenCols;
EdFrozenRows.Value := WorksheetGrid.FrozenRows;
SetupBackgroundColorBox;
// Create a tab in the pagecontrol for each worksheet contained in the workbook
// This would be easer with a TTabControl. This has display issues, though.
pages := TStringList.Create;
try
sWorksheetGrid1.GetSheets(pages);
sWorksheetGrid1.Parent := PageControl1.Pages[0];
WorksheetGrid.GetSheets(pages);
WorksheetGrid.Parent := PageControl1.Pages[0];
while PageControl1.PageCount > pages.Count do PageControl1.Pages[1].Free;
while PageControl1.PageCount < pages.Count do PageControl1.AddTabSheet;
for i:=0 to PageControl1.PageCount-1 do
@ -619,13 +677,13 @@ begin
pages.Free;
end;
sWorksheetGrid1Selection(nil, sWorksheetGrid1.Col, sWorksheetGrid1.Row);
WorksheetGridSelection(nil, WorksheetGrid.Col, WorksheetGrid.Row);
end;
procedure TForm1.PageControl1Change(Sender: TObject);
begin
sWorksheetGrid1.Parent := PageControl1.Pages[PageControl1.ActivePageIndex];
sWorksheetGrid1.SelectSheetByIndex(PageControl1.ActivePageIndex);
WorksheetGrid.Parent := PageControl1.Pages[PageControl1.ActivePageIndex];
WorksheetGrid.SelectSheetByIndex(PageControl1.ActivePageIndex);
end;
procedure TForm1.SetupBackgroundColorBox;
@ -636,17 +694,17 @@ begin
CbBackgroundColor.Style := CbBackgroundColor.Style + [cbCustomColors];
end;
procedure TForm1.sWorksheetGrid1Selection(Sender: TObject; aCol, aRow: Integer);
procedure TForm1.WorksheetGridSelection(Sender: TObject; aCol, aRow: Integer);
var
r, c: Cardinal;
begin
if sWorksheetGrid1.Workbook = nil then
if WorksheetGrid.Workbook = nil then
exit;
if AcCopyFormat.Checked then begin
r := sWorksheetGrid1.GetWorksheetRow(ARow);
c := sWorksheetGrid1.GetWorksheetCol(ACol);
sWorksheetGrid1.Worksheet.CopyFormat(@FCopiedFormat, r, c);
r := WorksheetGrid.GetWorksheetRow(ARow);
c := WorksheetGrid.GetWorksheetCol(ACol);
WorksheetGrid.Worksheet.CopyFormat(@FCopiedFormat, r, c);
AcCopyFormat.Checked := false;
end;
@ -658,6 +716,7 @@ begin
UpdateFontNameIndex;
UpdateFontSizeIndex;
UpdateFontStyleActions;
UpdateTextRotationActions;
UpdateNumFormatActions;
end;
@ -665,7 +724,7 @@ procedure TForm1.UpdateBackgroundColorIndex;
var
sClr: TsColor;
begin
with sWorksheetGrid1 do sClr := BackgroundColors[Selection];
with WorksheetGrid do sClr := BackgroundColors[Selection];
if sClr = scNotDefined then
CbBackgroundColor.ItemIndex := -1
else
@ -678,9 +737,9 @@ var
ac: TAction;
hor_align: TsHorAlignment;
begin
with sWorksheetGrid1 do hor_align := HorAlignments[Selection];
for i:=0 to ActionList1.ActionCount-1 do begin
ac := TAction(ActionList1.Actions[i]);
with WorksheetGrid do hor_align := HorAlignments[Selection];
for i:=0 to ActionList.ActionCount-1 do begin
ac := TAction(ActionList.Actions[i]);
if (ac.Tag >= HORALIGN_TAG) and (ac.Tag < HORALIGN_TAG+10) then
ac.Checked := ((ac.Tag - HORALIGN_TAG) = ord(hor_align));
end;
@ -690,7 +749,7 @@ procedure TForm1.UpdateFontNameIndex;
var
fname: String;
begin
with sWorksheetGrid1 do fname := CellFontNames[Selection];
with WorksheetGrid do fname := CellFontNames[Selection];
if fname = '' then
FontCombobox.ItemIndex := -1
else
@ -701,7 +760,7 @@ procedure TForm1.UpdateFontSizeIndex;
var
sz: Single;
begin
with sWorksheetGrid1 do sz := CellFontSizes[Selection];
with WorksheetGrid do sz := CellFontSizes[Selection];
if sz < 0 then
FontSizeCombobox.ItemIndex := -1
else
@ -712,7 +771,7 @@ procedure TForm1.UpdateFontStyleActions;
var
style: TsFontStyles;
begin
with sWorksheetGrid1 do style := CellFontStyles[Selection];
with WorksheetGrid do style := CellFontStyles[Selection];
AcFontBold.Checked := fssBold in style;
AcFontItalic.Checked := fssItalic in style;
AcFontUnderline.Checked := fssUnderline in style;
@ -726,19 +785,33 @@ var
nf: TsNumberFormat;
cell: PCell;
r,c: Cardinal;
found: Boolean;
t: Integer;
begin
with sWorksheetGrid1 do begin
with WorksheetGrid do begin
r := GetWorksheetRow(Row);
c := GetWorksheetCol(Col);
cell := Worksheet.FindCell(r, c);
if (cell = nil) or (cell^.ContentType <> cctNumber) then
if (cell = nil) or not (cell^.ContentType in [cctNumber, cctDateTime]) then
nf := nfGeneral
else
nf := cell^.NumberFormat;
for i:=0 to ActionList1.ActionCount-1 do begin
ac := TAction(ActionList1.Actions[i]);
if (ac.Tag >= NUMFMT_TAG) and (ac.Tag < NUMFMT_TAG + 20) then
ac.Checked := ((ac.Tag - NUMFMT_TAG) = ord(nf));
for i:=0 to ActionList.ActionCount-1 do begin
ac := TAction(ActionList.Actions[i]);
t := ac.Tag;
if (ac.Tag >= NUMFMT_TAG) and (ac.Tag < NUMFMT_TAG + 200) then begin
found := ((ac.Tag - NUMFMT_TAG) div 10 = ord(nf));
if (nf = nfFmtDateTime) then
case (ac.Tag - NUMFMT_TAG) mod 10 of
1: found := pos('d/m', cell^.NumberFormatStr) > 0;
2: found := pos('m/y', cell^.NumberFormatStr) > 0;
3: found := (pos('n:s', cell^.NumberFormatStr) > 0)
and (pos ('.z', cell^.NumberFormatStr) = 0);
4: found := (pos('n:s', cell^.NumberFormatStr) > 0)
and (pos ('.z', cell^.NumberFormatStr) > 0);
end;
ac.Checked := found;
end;
end;
end;
end;
@ -749,9 +822,9 @@ var
ac: TAction;
text_rot: TsTextRotation;
begin
with sWorksheetGrid1 do text_rot := TextRotations[Selection];
for i:=0 to ActionList1.ActionCount-1 do begin
ac := TAction(ActionList1.Actions[i]);
with WorksheetGrid do text_rot := TextRotations[Selection];
for i:=0 to ActionList.ActionCount-1 do begin
ac := TAction(ActionList.Actions[i]);
if (ac.Tag >= TEXTROT_TAG) and (ac.Tag < TEXTROT_TAG+10) then
ac.Checked := ((ac.Tag - TEXTROT_TAG) = ord(text_rot));
end;
@ -764,9 +837,9 @@ var
vert_align: TsVertAlignment;
t: Integer;
begin
with sWorksheetGrid1 do vert_align := VertAlignments[Selection];
for i:=0 to ActionList1.ActionCount-1 do begin
ac := TAction(ActionList1.Actions[i]);
with WorksheetGrid do vert_align := VertAlignments[Selection];
for i:=0 to ActionList.ActionCount-1 do begin
ac := TAction(ActionList.Actions[i]);
t := ac.tag;
if (ac.Tag >= VERTALIGN_TAG) and (ac.Tag < VERTALIGN_TAG+10) then
ac.Checked := ((ac.Tag - VERTALIGN_TAG) = ord(vert_align));
@ -777,7 +850,7 @@ procedure TForm1.UpdateWordwraps;
var
wrapped: Boolean;
begin
with sWorksheetGrid1 do wrapped := Wordwraps[Selection];
with WorksheetGrid do wrapped := Wordwraps[Selection];
AcWordwrap.Checked := wrapped;
end;

View File

@ -404,13 +404,17 @@ type
procedure WriteBlank(ARow, ACol: Cardinal);
procedure WriteBoolValue(ARow, ACol: Cardinal; AValue: Boolean);
procedure WriteDateTime(ARow, ACol: Cardinal; AValue: TDateTime;
AFormat: TsNumberFormat = nfShortDateTime; AFormatStr: String = '');
AFormat: TsNumberFormat = nfShortDateTime; AFormatStr: String = ''); overload;
procedure WriteDateTime(ACell: PCell; AValue: TDateTime;
AFormat: TsNumberFormat = nfShortDateTime; AFormatStr: String = ''); overload;
procedure WriteErrorValue(ARow, ACol: Cardinal; AValue: TErrorValue); overload;
procedure WriteErrorValue(ACell: PCell; AValue: TErrorValue); overload;
procedure WriteFormula(ARow, ACol: Cardinal; AFormula: TsFormula);
procedure WriteNumber(ARow, ACol: Cardinal; ANumber: double;
AFormat: TsNumberFormat = nfGeneral; ADecimals: Byte = 2;
ACurrencySymbol: String = ''); overload;
procedure WriteNumber(ACell: PCell; ANumber: Double; AFormat: TsNumberFormat = nfGeneral;
ADecimals: Byte = 2; ACurrencySymbol: String = ''); overload;
procedure WriteNumber(ARow, ACol: Cardinal; ANumber: double;
AFormatString: String); overload;
procedure WriteRPNFormula(ARow, ACol: Cardinal; AFormula: TsRPNFormula);
@ -1456,34 +1460,41 @@ end;
procedure TsWorksheet.WriteNumber(ARow, ACol: Cardinal; ANumber: double;
AFormat: TsNumberFormat = nfGeneral; ADecimals: Byte = 2;
ACurrencySymbol: String = '');
begin
WriteNumber(GetCell(ARow, ACol), ANumber, AFormat, ADecimals, ACurrencySymbol);
end;
procedure TsWorksheet.WriteNumber(ACell: PCell; ANumber: Double;
AFormat: TsNumberFormat = nfGeneral; ADecimals: Byte = 2;
ACurrencySymbol: String = '');
var
ACell: PCell;
fs: TFormatSettings;
begin
ACell := GetCell(ARow, ACol);
ACell^.ContentType := cctNumber;
ACell^.NumberValue := ANumber;
ACell^.Decimals := ADecimals;
if IsDateTimeFormat(AFormat) then
raise Exception.Create(lpInvalidNumberFormat);
{
if AFormat = nfCustom then
raise Exception.Create(lpIllegalNumberformat);
}
if AFormat <> nfGeneral then begin
Include(ACell^.UsedFormattingFields, uffNumberFormat);
ACell^.NumberFormat := AFormat;
if ACell <> nil then begin
ACell^.ContentType := cctNumber;
ACell^.NumberValue := ANumber;
ACell^.Decimals := ADecimals;
ACell^.CurrencySymbol := ACurrencySymbol;
ACell^.NumberFormatStr := BuildNumberFormatString(ACell^.NumberFormat,
Workbook.FormatSettings, ADecimals, ACurrencySymbol);
end;
ChangedCell(ARow, ACol);
if IsDateTimeFormat(AFormat) then
raise Exception.Create(lpInvalidNumberFormat);
{
if AFormat = nfCustom then
raise Exception.Create(lpIllegalNumberformat);
}
if AFormat <> nfGeneral then begin
Include(ACell^.UsedFormattingFields, uffNumberFormat);
ACell^.NumberFormat := AFormat;
ACell^.Decimals := ADecimals;
ACell^.CurrencySymbol := ACurrencySymbol;
ACell^.NumberFormatStr := BuildNumberFormatString(ACell^.NumberFormat,
Workbook.FormatSettings, ADecimals, ACurrencySymbol);
end;
ChangedCell(ACell^.Row, ACell^.Col);
end;
end;
{@@
@ -1577,23 +1588,28 @@ end;
}
procedure TsWorksheet.WriteDateTime(ARow, ACol: Cardinal; AValue: TDateTime;
AFormat: TsNumberFormat = nfShortDateTime; AFormatStr: String = '');
var
ACell: PCell;
begin
if (AFormat in [nfFmtDateTime, nfTimeInterval]) then
AFormatStr := BuildDateTimeFormatString(AFormat, Workbook.FormatSettings, AFormatStr);
WriteDateTime(GetCell(ARow, ACol), AValue, AFormat, AFormatStr);
end;
ACell := GetCell(ARow, ACol);
ACell^.ContentType := cctDateTime;
ACell^.DateTimeValue := AValue;
// Date/time is actually a number field in Excel.
// To make sure it gets saved correctly, set a date format (instead of General).
// The user can choose another date format if he wants to
Include(ACell^.UsedFormattingFields, uffNumberFormat);
ACell^.NumberFormat := AFormat;
ACell^.NumberFormatStr := AFormatStr;
procedure TsWorksheet.WriteDateTime(ACell: PCell; AValue: TDateTime;
AFormat: TsNumberFormat = nfShortDateTime; AFormatStr: String = '');
begin
if ACell <> nil then begin
if (AFormat in [nfFmtDateTime, nfTimeInterval]) then
AFormatStr := BuildDateTimeFormatString(AFormat, Workbook.FormatSettings, AFormatStr);
ChangedCell(ARow, ACol);
ACell^.ContentType := cctDateTime;
ACell^.DateTimeValue := AValue;
// Date/time is actually a number field in Excel.
// To make sure it gets saved correctly, set a date format (instead of General).
// The user can choose another date format if he wants to
Include(ACell^.UsedFormattingFields, uffNumberFormat);
ACell^.NumberFormat := AFormat;
ACell^.NumberFormatStr := AFormatStr;
ChangedCell(ACell^.Row, ACell^.Col);
end;
end;
procedure TsWorksheet.WriteDecimals(ARow, ACol: Cardinal; ADecimals: Byte);
@ -1664,6 +1680,7 @@ procedure TsWorksheet.WriteNumberFormat(ARow, ACol: Cardinal;
ANumberFormat: TsNumberFormat; const AFormatString: String = '');
var
ACell: PCell;
oldNumFmt: TsNumberFormat;
begin
ACell := GetCell(ARow, ACol);
Include(ACell^.UsedFormattingFields, uffNumberFormat);

View File

@ -105,7 +105,6 @@ type
{ Protected declarations }
procedure DefaultDrawCell(ACol, ARow: Integer; var ARect: TRect; AState: TGridDrawState); override;
procedure DoPrepareCanvas(ACol, ARow: Integer; AState: TGridDrawState); override;
// procedure DrawAccountingCell(ACell: PCell; ARect: TRect; AState: TGridDrawState);
procedure DrawAllRows; override;
procedure DrawCellBorders; overload;
procedure DrawCellBorders(ACol, ARow: Integer; ARect: TRect); overload;