spready: Use decrypting xlsx reader. Add cell and worksheet protection.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5814 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
18965c7740
commit
e3d40d489f
@ -31,7 +31,8 @@ type
|
|||||||
procedure ProcessRecord(ARecordType: String; const AFields: TsSYLKFields);
|
procedure ProcessRecord(ARecordType: String; const AFields: TsSYLKFields);
|
||||||
public
|
public
|
||||||
constructor Create(AWorkbook: TsWorkbook); override;
|
constructor Create(AWorkbook: TsWorkbook); override;
|
||||||
procedure ReadFromFile(AFileName: String; AParams: TsStreamParams = []); override;
|
procedure ReadFromFile(AFileName: String; APassword: String = '';
|
||||||
|
AParams: TsStreamParams = []); override;
|
||||||
procedure ReadFromStrings(AStrings: TStrings; AParams: TsStreamParams = []); override;
|
procedure ReadFromStrings(AStrings: TStrings; AParams: TsStreamParams = []); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -335,10 +336,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TsSYLKReader.ReadFromFile(AFileName: String;
|
procedure TsSYLKReader.ReadFromFile(AFileName: String;
|
||||||
AParams: TsStreamParams = []);
|
APassword: String = ''; AParams: TsStreamParams = []);
|
||||||
begin
|
begin
|
||||||
FWorksheetName := ChangeFileExt(ExtractFileName(AFileName), '');
|
FWorksheetName := ChangeFileExt(ExtractFileName(AFileName), '');
|
||||||
inherited ReadFromFile(AFilename, AParams);
|
inherited ReadFromFile(AFilename, APassword, AParams);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TsSYLKReader.ReadFromStrings(AStrings: TStrings;
|
procedure TsSYLKReader.ReadFromStrings(AStrings: TStrings;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
object MainForm: TMainForm
|
object MainForm: TMainForm
|
||||||
Left = 267
|
Left = 265
|
||||||
Height = 709
|
Height = 709
|
||||||
Top = 152
|
Top = 139
|
||||||
Width = 1120
|
Width = 1120
|
||||||
Caption = 'spready'
|
Caption = 'spready'
|
||||||
ClientHeight = 689
|
ClientHeight = 689
|
||||||
@ -37,7 +37,6 @@ object MainForm: TMainForm
|
|||||||
WorkbookSource = WorkbookSource
|
WorkbookSource = WorkbookSource
|
||||||
Align = alClient
|
Align = alClient
|
||||||
AutoAdvance = aaDown
|
AutoAdvance = aaDown
|
||||||
ColCount = 27
|
|
||||||
DefaultColWidth = 64
|
DefaultColWidth = 64
|
||||||
DefaultRowHeight = 22
|
DefaultRowHeight = 22
|
||||||
Font.Color = clBlack
|
Font.Color = clBlack
|
||||||
@ -46,7 +45,6 @@ object MainForm: TMainForm
|
|||||||
MouseWheelOption = mwGrid
|
MouseWheelOption = mwGrid
|
||||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goEditing, goThumbTracking, goDblClickAutoSize, goCellHints]
|
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goEditing, goThumbTracking, goDblClickAutoSize, goCellHints]
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
RowCount = 101
|
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
TitleFont.Color = clBlack
|
TitleFont.Color = clBlack
|
||||||
TitleFont.Height = -13
|
TitleFont.Height = -13
|
||||||
@ -83,7 +81,7 @@ object MainForm: TMainForm
|
|||||||
Align = alClient
|
Align = alClient
|
||||||
DefaultColWidth = 100
|
DefaultColWidth = 100
|
||||||
MouseWheelOption = mwGrid
|
MouseWheelOption = mwGrid
|
||||||
RowCount = 33
|
RowCount = 39
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
TitleStyle = tsNative
|
TitleStyle = tsNative
|
||||||
OnEnter = InspectorEnter
|
OnEnter = InspectorEnter
|
||||||
@ -101,8 +99,8 @@ object MainForm: TMainForm
|
|||||||
' ListSeparator=;'
|
' ListSeparator=;'
|
||||||
' DateSeparator=.'
|
' DateSeparator=.'
|
||||||
' TimeSeparator=:'
|
' TimeSeparator=:'
|
||||||
' ShortDateFormat=dd.MM.yy'
|
' ShortDateFormat=dd.MM.yyyy'
|
||||||
' LongDateFormat=dd.MMM.yyyy'
|
' LongDateFormat=dddd, d. MMMM yyyy'
|
||||||
' ShortTimeFormat=hh:nn'
|
' ShortTimeFormat=hh:nn'
|
||||||
' LongTimeFormat=hh:nn:ss'
|
' LongTimeFormat=hh:nn:ss'
|
||||||
' TimeAMString='
|
' TimeAMString='
|
||||||
@ -123,6 +121,12 @@ object MainForm: TMainForm
|
|||||||
' Font3=Arial; size 10; black; italic'
|
' Font3=Arial; size 10; black; italic'
|
||||||
'(-) Cell formats='
|
'(-) Cell formats='
|
||||||
' CellFormat0=nfGeneral'
|
' CellFormat0=nfGeneral'
|
||||||
|
'Protection=(default)'
|
||||||
|
'(-) CryptoInfo='
|
||||||
|
' PasswordHash='
|
||||||
|
' Algorithm='
|
||||||
|
' SaltValue='
|
||||||
|
' SpinCount=0'
|
||||||
)
|
)
|
||||||
TitleCaptions.Strings = (
|
TitleCaptions.Strings = (
|
||||||
'Properties'
|
'Properties'
|
||||||
@ -177,7 +181,6 @@ object MainForm: TMainForm
|
|||||||
Left = 376
|
Left = 376
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton10'
|
Caption = 'ToolButton10'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -205,7 +208,6 @@ object MainForm: TMainForm
|
|||||||
Left = 453
|
Left = 453
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton15'
|
Caption = 'ToolButton15'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -228,7 +230,6 @@ object MainForm: TMainForm
|
|||||||
Left = 530
|
Left = 530
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton19'
|
Caption = 'ToolButton19'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -254,14 +255,6 @@ object MainForm: TMainForm
|
|||||||
Top = 0
|
Top = 0
|
||||||
Action = AcNumFormatPercentage
|
Action = AcNumFormatPercentage
|
||||||
end
|
end
|
||||||
object ToolButton23: TToolButton
|
|
||||||
Left = 896
|
|
||||||
Height = 26
|
|
||||||
Top = 0
|
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton23'
|
|
||||||
Style = tbsDivider
|
|
||||||
end
|
|
||||||
object ToolButton24: TToolButton
|
object ToolButton24: TToolButton
|
||||||
Left = 660
|
Left = 660
|
||||||
Top = 0
|
Top = 0
|
||||||
@ -304,7 +297,6 @@ object MainForm: TMainForm
|
|||||||
Left = 855
|
Left = 855
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton31'
|
Caption = 'ToolButton31'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -321,12 +313,11 @@ object MainForm: TMainForm
|
|||||||
Left = 780
|
Left = 780
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton3'
|
Caption = 'ToolButton3'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
object ToolButton5: TToolButton
|
object ToolButton5: TToolButton
|
||||||
Left = 901
|
Left = 896
|
||||||
Top = 0
|
Top = 0
|
||||||
Action = AcMergeCells
|
Action = AcMergeCells
|
||||||
end
|
end
|
||||||
@ -344,7 +335,6 @@ object MainForm: TMainForm
|
|||||||
Left = 25
|
Left = 25
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton38'
|
Caption = 'ToolButton38'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -408,10 +398,24 @@ object MainForm: TMainForm
|
|||||||
Left = 559
|
Left = 559
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton45'
|
Caption = 'ToolButton45'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
|
object ToolButton56: TToolButton
|
||||||
|
Left = 920
|
||||||
|
Height = 26
|
||||||
|
Top = 0
|
||||||
|
Caption = 'ToolButton56'
|
||||||
|
Style = tbsDivider
|
||||||
|
end
|
||||||
|
object ToolButton58: TToolButton
|
||||||
|
Left = 925
|
||||||
|
Top = 0
|
||||||
|
Caption = 'ToolButton58'
|
||||||
|
DropdownMenu = PuCellProtection
|
||||||
|
ImageIndex = 73
|
||||||
|
Style = tbsButtonDrop
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object ToolBar2: TToolBar
|
object ToolBar2: TToolBar
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -444,7 +448,6 @@ object MainForm: TMainForm
|
|||||||
Left = 357
|
Left = 357
|
||||||
Height = 24
|
Height = 24
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton1'
|
Caption = 'ToolButton1'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -464,7 +467,6 @@ object MainForm: TMainForm
|
|||||||
Left = 251
|
Left = 251
|
||||||
Height = 24
|
Height = 24
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton28'
|
Caption = 'ToolButton28'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -497,7 +499,6 @@ object MainForm: TMainForm
|
|||||||
Left = 174
|
Left = 174
|
||||||
Height = 24
|
Height = 24
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton43'
|
Caption = 'ToolButton43'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -505,7 +506,6 @@ object MainForm: TMainForm
|
|||||||
Left = 304
|
Left = 304
|
||||||
Height = 24
|
Height = 24
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton44'
|
Caption = 'ToolButton44'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -530,7 +530,6 @@ object MainForm: TMainForm
|
|||||||
Left = 85
|
Left = 85
|
||||||
Height = 24
|
Height = 24
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton49'
|
Caption = 'ToolButton49'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -553,7 +552,6 @@ object MainForm: TMainForm
|
|||||||
Left = 434
|
Left = 434
|
||||||
Height = 24
|
Height = 24
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton52'
|
Caption = 'ToolButton52'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -576,7 +574,6 @@ object MainForm: TMainForm
|
|||||||
Left = 511
|
Left = 511
|
||||||
Height = 24
|
Height = 24
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton54'
|
Caption = 'ToolButton54'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -589,7 +586,6 @@ object MainForm: TMainForm
|
|||||||
Left = 540
|
Left = 540
|
||||||
Height = 24
|
Height = 24
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
|
||||||
Caption = 'ToolButton55'
|
Caption = 'ToolButton55'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
@ -624,10 +620,10 @@ object MainForm: TMainForm
|
|||||||
Height = 23
|
Height = 23
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 138
|
Width = 138
|
||||||
|
WorkbookSource = WorkbookSource
|
||||||
Align = alTop
|
Align = alTop
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
Text = 'A1'
|
Text = 'A1'
|
||||||
WorkbookSource = WorkbookSource
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object CellEdit: TsCellEdit
|
object CellEdit: TsCellEdit
|
||||||
@ -1892,12 +1888,30 @@ object MainForm: TMainForm
|
|||||||
Hint = 'Set width of current column'
|
Hint = 'Set width of current column'
|
||||||
OnExecute = AcColWidthExecute
|
OnExecute = AcColWidthExecute
|
||||||
end
|
end
|
||||||
|
object AcCellProtection_Cell: TsCellProtectionAction
|
||||||
|
Category = 'FPSpreadsheet'
|
||||||
|
WorkbookSource = WorkbookSource
|
||||||
|
Caption = 'Protect cell'
|
||||||
|
end
|
||||||
|
object AcCellProtection_HideFormulas: TsCellProtectionAction
|
||||||
|
Category = 'FPSpreadsheet'
|
||||||
|
WorkbookSource = WorkbookSource
|
||||||
|
Caption = 'Hide formulas'
|
||||||
|
Protection = cpHideFormulas
|
||||||
|
end
|
||||||
|
object AcWorksheetProtection: TAction
|
||||||
|
Category = 'Worksheet'
|
||||||
|
Caption = 'Protect worksheet...'
|
||||||
|
ImageIndex = 73
|
||||||
|
OnExecute = AcWorksheetProtectionExecute
|
||||||
|
OnUpdate = AcWorksheetProtectionUpdate
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object ImageList: TImageList
|
object ImageList: TImageList
|
||||||
left = 176
|
left = 176
|
||||||
top = 312
|
top = 312
|
||||||
Bitmap = {
|
Bitmap = {
|
||||||
4C69490000001000000010000000003F9300003F9300003F9300003F9424003F
|
4C694A0000001000000010000000003F9300003F9300003F9300003F9424003F
|
||||||
948A003E93CC004095CC004095CC004095CC004095CC004095CC004095CC0040
|
948A003E93CC004095CC004095CC004095CC004095CC004095CC004095CC0040
|
||||||
95CC004095CC00409599003F9400003F9300003F9324003F938A0E4B9CD33F76
|
95CC004095CC00409599003F9400003F9300003F9324003F938A0E4B9CD33F76
|
||||||
C0EC5D90D4FF3365A9FFA0A0A0FFA9A9A9FFA9A9A9FFAAAAAAFFACACACFFAEAE
|
C0EC5D90D4FF3365A9FFA0A0A0FFA9A9A9FFA9A9A9FFAAAAAAFFACACACFFAEAE
|
||||||
@ -4233,6 +4247,38 @@ object MainForm: TMainForm
|
|||||||
001A7205006B720500A5720500C3720500C3720500A57205006B7506001A800E
|
001A7205006B720500A5720500C3720500C3720500A57205006B7506001A800E
|
||||||
010090170200951A0200FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
010090170200951A0200FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000278B3000278B300037A
|
||||||
|
B6000380BE330380BF720380BF890380BF890380BF720380BE33037AB6000278
|
||||||
|
B3000278B300FFFFFF00FFFFFF00FFFFFF00FFFFFF000278B3000278B3000379
|
||||||
|
B5351D8CC29B7ECDEBE16AB5D1EA6AB5D1EA7ECDEBE11D8CC29B0379B5350278
|
||||||
|
B3000278B300FFFFFF00FFFFFF00FFFFFF00FFFFFF000272AA000272AA000272
|
||||||
|
AA7A7CC8E7E6388AB2D5015B8891015B8891388AB2D57CC8E7E60272AA7A0272
|
||||||
|
AA000272AA00FFFFFF00FFFFFF00FFFFFF00FFFFFF000376B00002699D000269
|
||||||
|
9D9784C9E6FD066594B9015F8E00015F8E00066594B984C9E6FD02699D970269
|
||||||
|
9D000375AE00FFFFFF00FFFFFF00FFFFFF00FFFFFF000381BF000377B1000160
|
||||||
|
90A376BADBFF016494B201689A00015A8700016494B278BCDDFF016090A30272
|
||||||
|
AA00037EBB00FFFFFF00FFFFFF00FFFFFF00FFFFFF000381BF69037DBA8F0059
|
||||||
|
86A865AACCFF016698AD01699CA9005783CA016698AD4B91B5FF005986A80276
|
||||||
|
B09B037EBB6DFFFFFF00FFFFFF00FFFFFF00FFFFFF000381BF8BA5E9FFFF9CDF
|
||||||
|
FAFF94D7F4FF8CCEEEFF83C7E8FF5EB4D7FF5EBADEFF5EC2E8FF5ECAF2FF62D6
|
||||||
|
FBFF037EBB90FFFFFF00FFFFFF00FFFFFF00FFFFFF000381BF8B66AACAFF68AC
|
||||||
|
CEFF6CB0D2FF6EB1D3FF6AAED0FF559DBFFF55A0C2FF55A5CAFF55ABD3FF5AB8
|
||||||
|
DEFF037EBB90FFFFFF00FFFFFF00FFFFFF00FFFFFF000381BF8BA5E9FFFF9CDF
|
||||||
|
FAFF94D7F4FF8CCEEEFF83C7E8FF5EB4D7FF5EBADEFF5EC2E8FF5ECAF2FF62D6
|
||||||
|
FBFF037EBB90FFFFFF00FFFFFF00FFFFFF00FFFFFF00037DBA8A66AACAFF68AC
|
||||||
|
CEFF6CB0D2FF6EB1D3FF6AAED0FF559DBFFF55A0C2FF55A5CAFF55ABD3FF5AB8
|
||||||
|
DEFF037AB68FFFFFFF00FFFFFF00FFFFFF00FFFFFF0002669F87A5E9FFFF9CDF
|
||||||
|
FAFF94D7F4FF8CCEEEFF83C7E8FF5EB4D7FF5EBADEFF5EC2E8FF5ECAF2FF62D6
|
||||||
|
FBFF02659C8AFFFFFF00FFFFFF00FFFFFF00FFFFFF00014B7C8D66AACAFF68AC
|
||||||
|
CEFF6CB0D2FF6EB1D3FF6AAED0FF559DBFFF55A0C2FF55A5CAFF55ABD3FF5AB8
|
||||||
|
DEFF014A7B8FFFFFFF00FFFFFF00FFFFFF00FFFFFF00013763A0A9EDFFFFA4E7
|
||||||
|
FCFF9CDFF8FF94D6F4FF8BCFF0FF66BCDEFF66C2E4FF66CAECFF66D2F4FF66DA
|
||||||
|
FCFF013763A0FFFFFF00FFFFFF00FFFFFF00FFFFFF00002C5695002F5AB30037
|
||||||
|
649E0146769301578895016294A2002D57BD002D57BC002D57BC002D58BC002D
|
||||||
|
58BC002E598BFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF00
|
FF00FFFFFF00FFFFFF00FFFFFF00
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -4314,6 +4360,9 @@ object MainForm: TMainForm
|
|||||||
object MenuItem160: TMenuItem
|
object MenuItem160: TMenuItem
|
||||||
Action = acRenameWorksheet
|
Action = acRenameWorksheet
|
||||||
end
|
end
|
||||||
|
object MenuItem106: TMenuItem
|
||||||
|
Action = AcWorksheetProtection
|
||||||
|
end
|
||||||
object MenuItem165: TMenuItem
|
object MenuItem165: TMenuItem
|
||||||
Caption = '-'
|
Caption = '-'
|
||||||
end
|
end
|
||||||
@ -4866,4 +4915,16 @@ object MainForm: TMainForm
|
|||||||
left = 504
|
left = 504
|
||||||
top = 536
|
top = 536
|
||||||
end
|
end
|
||||||
|
object PuCellProtection: TPopupMenu
|
||||||
|
left = 504
|
||||||
|
top = 600
|
||||||
|
object MenuItem104: TMenuItem
|
||||||
|
Action = AcCellProtection_Cell
|
||||||
|
AutoCheck = True
|
||||||
|
end
|
||||||
|
object MenuItem105: TMenuItem
|
||||||
|
Action = AcCellProtection_HideFormulas
|
||||||
|
AutoCheck = True
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -6,9 +6,12 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, mrumanager, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, FileUtil, mrumanager, Forms, Controls, Graphics, Dialogs,
|
||||||
ExtCtrls, ComCtrls, ActnList, Menus, StdActns, Buttons, fpstypes,
|
ExtCtrls, ComCtrls, ActnList, Menus, StdActns, Buttons, Grids, types,
|
||||||
fpspreadsheet, fpspreadsheetctrls, fpspreadsheetgrid, fpsActions,
|
fpstypes, fpspreadsheet, fpspreadsheetctrls, fpspreadsheetgrid, fpsActions,
|
||||||
fpsSYLK, xlsxml, Grids, Types;
|
fpsAllFormats, fpsSYLK, xlsxml, xlsxooxml_crypto;
|
||||||
|
// NOTE:
|
||||||
|
// In order to use the decrypting xlsx reader put xlsxooxlm_cryto after
|
||||||
|
// xlsxooxml or fpsAllforamts.
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -34,6 +37,7 @@ type
|
|||||||
AcSortColAsc: TAction;
|
AcSortColAsc: TAction;
|
||||||
AcRowHeight: TAction;
|
AcRowHeight: TAction;
|
||||||
AcColWidth: TAction;
|
AcColWidth: TAction;
|
||||||
|
AcWorksheetProtection: TAction;
|
||||||
AcWorksheetRTL: TAction;
|
AcWorksheetRTL: TAction;
|
||||||
AcViewInspector: TAction;
|
AcViewInspector: TAction;
|
||||||
ActionList: TActionList;
|
ActionList: TActionList;
|
||||||
@ -45,6 +49,9 @@ type
|
|||||||
MenuItem1: TMenuItem;
|
MenuItem1: TMenuItem;
|
||||||
MenuItem102: TMenuItem;
|
MenuItem102: TMenuItem;
|
||||||
MenuItem103: TMenuItem;
|
MenuItem103: TMenuItem;
|
||||||
|
MenuItem104: TMenuItem;
|
||||||
|
MenuItem105: TMenuItem;
|
||||||
|
MenuItem106: TMenuItem;
|
||||||
MenuItem160: TMenuItem;
|
MenuItem160: TMenuItem;
|
||||||
MenuItem161: TMenuItem;
|
MenuItem161: TMenuItem;
|
||||||
MenuItem162: TMenuItem;
|
MenuItem162: TMenuItem;
|
||||||
@ -244,6 +251,7 @@ type
|
|||||||
AcNumFormatCurrency: TsNumberFormatAction;
|
AcNumFormatCurrency: TsNumberFormatAction;
|
||||||
AcNumFormatCurrencyRed: TsNumberFormatAction;
|
AcNumFormatCurrencyRed: TsNumberFormatAction;
|
||||||
Panel2: TPanel;
|
Panel2: TPanel;
|
||||||
|
PuCellProtection: TPopupMenu;
|
||||||
PuRecentFiles: TPopupMenu;
|
PuRecentFiles: TPopupMenu;
|
||||||
PuPaste: TPopupMenu;
|
PuPaste: TPopupMenu;
|
||||||
PuBorders: TPopupMenu;
|
PuBorders: TPopupMenu;
|
||||||
@ -308,6 +316,8 @@ type
|
|||||||
AcCellBorderDiagUp: TsCellBorderAction;
|
AcCellBorderDiagUp: TsCellBorderAction;
|
||||||
AcCellBorderDiagDown: TsCellBorderAction;
|
AcCellBorderDiagDown: TsCellBorderAction;
|
||||||
AcNumFormatText: TsNumberFormatAction;
|
AcNumFormatText: TsNumberFormatAction;
|
||||||
|
AcCellProtection_Cell: TsCellProtectionAction;
|
||||||
|
AcCellProtection_HideFormulas: TsCellProtectionAction;
|
||||||
Splitter2: TSplitter;
|
Splitter2: TSplitter;
|
||||||
Splitter3: TSplitter;
|
Splitter3: TSplitter;
|
||||||
AcZoom100: TsWorksheetZoomAction;
|
AcZoom100: TsWorksheetZoomAction;
|
||||||
@ -345,7 +355,6 @@ type
|
|||||||
ToolButton20: TToolButton;
|
ToolButton20: TToolButton;
|
||||||
ToolButton21: TToolButton;
|
ToolButton21: TToolButton;
|
||||||
ToolButton22: TToolButton;
|
ToolButton22: TToolButton;
|
||||||
ToolButton23: TToolButton;
|
|
||||||
ToolButton24: TToolButton;
|
ToolButton24: TToolButton;
|
||||||
ToolButton25: TToolButton;
|
ToolButton25: TToolButton;
|
||||||
ToolButton26: TToolButton;
|
ToolButton26: TToolButton;
|
||||||
@ -385,6 +394,8 @@ type
|
|||||||
ToolButton53: TToolButton;
|
ToolButton53: TToolButton;
|
||||||
ToolButton54: TToolButton;
|
ToolButton54: TToolButton;
|
||||||
ToolButton55: TToolButton;
|
ToolButton55: TToolButton;
|
||||||
|
ToolButton56: TToolButton;
|
||||||
|
ToolButton58: TToolButton;
|
||||||
ToolButton6: TToolButton;
|
ToolButton6: TToolButton;
|
||||||
ToolButton7: TToolButton;
|
ToolButton7: TToolButton;
|
||||||
ToolButton8: TToolButton;
|
ToolButton8: TToolButton;
|
||||||
@ -414,6 +425,8 @@ type
|
|||||||
procedure AcSortColAscExecute(Sender: TObject);
|
procedure AcSortColAscExecute(Sender: TObject);
|
||||||
procedure AcSortExecute(Sender: TObject);
|
procedure AcSortExecute(Sender: TObject);
|
||||||
procedure ActionListUpdate(AAction: TBasicAction; var Handled: Boolean);
|
procedure ActionListUpdate(AAction: TBasicAction; var Handled: Boolean);
|
||||||
|
procedure AcWorksheetProtectionExecute(Sender: TObject);
|
||||||
|
procedure AcWorksheetProtectionUpdate(Sender: TObject);
|
||||||
procedure AcWorksheetRTLExecute(Sender: TObject);
|
procedure AcWorksheetRTLExecute(Sender: TObject);
|
||||||
procedure AcWorksheetRTLUpdate(Sender: TObject);
|
procedure AcWorksheetRTLUpdate(Sender: TObject);
|
||||||
procedure AcSearchExecute(Sender: TObject);
|
procedure AcSearchExecute(Sender: TObject);
|
||||||
@ -473,7 +486,7 @@ uses
|
|||||||
fpsUtils, fpsCSV, fpsReaderWriter,
|
fpsUtils, fpsCSV, fpsReaderWriter,
|
||||||
sCSVParamsForm, sCurrencyForm, sFormatSettingsForm, sSortParamsForm,
|
sCSVParamsForm, sCurrencyForm, sFormatSettingsForm, sSortParamsForm,
|
||||||
sHyperlinkForm, sNumFormatForm, sSearchForm, sColWidthForm, sRowHeightForm,
|
sHyperlinkForm, sNumFormatForm, sSearchForm, sColWidthForm, sRowHeightForm,
|
||||||
sAbout;
|
sWorksheetProtection, sAbout;
|
||||||
|
|
||||||
var
|
var
|
||||||
SEARCH_DLG_POS: TPoint = (X: -1; Y: -1);
|
SEARCH_DLG_POS: TPoint = (X: -1; Y: -1);
|
||||||
@ -866,6 +879,34 @@ begin
|
|||||||
UpdateInspectorColumns;
|
UpdateInspectorColumns;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.AcWorksheetProtectionExecute(Sender: TObject);
|
||||||
|
var
|
||||||
|
F: TWorksheetProtectionForm;
|
||||||
|
begin
|
||||||
|
if WorkbookSource.Worksheet.IsProtected then
|
||||||
|
WorkbookSource.Worksheet.Protect(false)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
F := TWorksheetProtectionForm.Create(nil);
|
||||||
|
try
|
||||||
|
F.IsProtected := WorkbookSource.Worksheet.IsProtected;
|
||||||
|
F.Protection := WorkbookSource.Worksheet.Protection;
|
||||||
|
if F.ShowModal = mrOK then
|
||||||
|
begin
|
||||||
|
WorkbookSource.Worksheet.Protection := F.Protection;
|
||||||
|
WorkbookSource.Worksheet.Protect(F.IsProtected);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
F.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.AcWorksheetProtectionUpdate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
AcWorksheetProtection.Checked := WorkbookSource.Worksheet.IsProtected;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.BeforeRun;
|
procedure TMainForm.BeforeRun;
|
||||||
begin
|
begin
|
||||||
ReadFromIni;
|
ReadFromIni;
|
||||||
@ -945,6 +986,7 @@ end;
|
|||||||
procedure TMainForm.FormCreate(Sender: TObject);
|
procedure TMainForm.FormCreate(Sender: TObject);
|
||||||
var
|
var
|
||||||
priorityFormats: Array[0..8] of TsSpreadFormatID;
|
priorityFormats: Array[0..8] of TsSpreadFormatID;
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
FMRUMenuManager := TMRUMenuManager.Create(self);
|
FMRUMenuManager := TMRUMenuManager.Create(self);
|
||||||
with FMRUMenuManager do begin
|
with FMRUMenuManager do begin
|
||||||
@ -970,6 +1012,9 @@ begin
|
|||||||
|
|
||||||
AcFileOpen.Dialog.Filter := GetFileFormatFilter('|', ';', faRead, priorityFormats, true, true);
|
AcFileOpen.Dialog.Filter := GetFileFormatFilter('|', ';', faRead, priorityFormats, true, true);
|
||||||
FOpenFormats := GetSpreadFormats(faRead, priorityFormats);
|
FOpenFormats := GetSpreadFormats(faRead, priorityFormats);
|
||||||
|
// Use decrypting XLSX format instead of normal XLSX format
|
||||||
|
for i:=0 to High(FOpenFormats) do
|
||||||
|
if FOpenFormats[i] = ord(sfOOXML) then FOpenFormats[i] := sfidOOXML_Crypto;
|
||||||
|
|
||||||
AcFileSaveAs.Dialog.Filter := GetFileFormatFilter('|', ';', faWrite, priorityFormats);
|
AcFileSaveAs.Dialog.Filter := GetFileFormatFilter('|', ';', faWrite, priorityFormats);
|
||||||
FSaveFormats := GetSpreadFormats(faWrite, priorityFormats);
|
FSaveFormats := GetSpreadFormats(faWrite, priorityFormats);
|
||||||
|
@ -57,15 +57,18 @@
|
|||||||
<FormatVersion Value="1"/>
|
<FormatVersion Value="1"/>
|
||||||
</local>
|
</local>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="2">
|
<RequiredPackages Count="3">
|
||||||
<Item1>
|
<Item1>
|
||||||
<PackageName Value="laz_fpspreadsheet_visual"/>
|
<PackageName Value="laz_fpspreadsheet_crypto"/>
|
||||||
</Item1>
|
</Item1>
|
||||||
<Item2>
|
<Item2>
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="laz_fpspreadsheet_visual"/>
|
||||||
</Item2>
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<PackageName Value="LCL"/>
|
||||||
|
</Item3>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="14">
|
<Units Count="15">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="spready.lpr"/>
|
<Filename Value="spready.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -89,7 +92,9 @@
|
|||||||
<Unit4>
|
<Unit4>
|
||||||
<Filename Value="scurrencyform.pas"/>
|
<Filename Value="scurrencyform.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="CurrencyForm"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
</Unit4>
|
</Unit4>
|
||||||
<Unit5>
|
<Unit5>
|
||||||
<Filename Value="sformatsettingsform.pas"/>
|
<Filename Value="sformatsettingsform.pas"/>
|
||||||
@ -154,6 +159,14 @@
|
|||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="sRowHeightForm"/>
|
<UnitName Value="sRowHeightForm"/>
|
||||||
</Unit13>
|
</Unit13>
|
||||||
|
<Unit14>
|
||||||
|
<Filename Value="sworksheetprotection.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="WorksheetProtectionForm"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
<UnitName Value="sWorksheetProtection"/>
|
||||||
|
</Unit14>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -7,7 +7,7 @@ uses
|
|||||||
cthreads,
|
cthreads,
|
||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}{$ENDIF}
|
||||||
Interfaces, // this includes the LCL widgetset
|
Interfaces, // this includes the LCL widgetset
|
||||||
Forms, smain, sColWidthForm;
|
Forms, smain, sColWidthForm, sWorksheetProtection;
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
|
103
applications/spready/sworksheetprotection.lfm
Normal file
103
applications/spready/sworksheetprotection.lfm
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
object WorksheetProtectionForm: TWorksheetProtectionForm
|
||||||
|
Left = 280
|
||||||
|
Height = 153
|
||||||
|
Top = 130
|
||||||
|
Width = 316
|
||||||
|
BorderStyle = bsDialog
|
||||||
|
Caption = 'Worksheet protection'
|
||||||
|
ClientHeight = 153
|
||||||
|
ClientWidth = 316
|
||||||
|
OnCreate = FormCreate
|
||||||
|
Position = poMainFormCenter
|
||||||
|
LCLVersion = '1.7'
|
||||||
|
object ButtonPanel: TButtonPanel
|
||||||
|
Left = 6
|
||||||
|
Height = 34
|
||||||
|
Top = 113
|
||||||
|
Width = 304
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
OKButton.Name = 'OKButton'
|
||||||
|
OKButton.DefaultCaption = True
|
||||||
|
HelpButton.Name = 'HelpButton'
|
||||||
|
HelpButton.DefaultCaption = True
|
||||||
|
CloseButton.Name = 'CloseButton'
|
||||||
|
CloseButton.DefaultCaption = True
|
||||||
|
CancelButton.Name = 'CancelButton'
|
||||||
|
CancelButton.DefaultCaption = True
|
||||||
|
TabOrder = 0
|
||||||
|
ShowButtons = [pbOK, pbCancel]
|
||||||
|
end
|
||||||
|
object CbProtect: TCheckBox
|
||||||
|
Left = 8
|
||||||
|
Height = 19
|
||||||
|
Top = 8
|
||||||
|
Width = 308
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
BorderSpacing.Bottom = 8
|
||||||
|
Caption = 'Protect worksheet and locked cells'
|
||||||
|
OnChange = CbProtectChange
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object LblProtectionItems: TLabel
|
||||||
|
Left = 8
|
||||||
|
Height = 15
|
||||||
|
Top = 46
|
||||||
|
Width = 300
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
BorderSpacing.Bottom = 4
|
||||||
|
Caption = 'All users of this worksheet are allowed to'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object TopBevel: TBevel
|
||||||
|
Left = 8
|
||||||
|
Height = 3
|
||||||
|
Top = 35
|
||||||
|
Width = 300
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
Shape = bsTopLine
|
||||||
|
end
|
||||||
|
object ItemsPanel: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 38
|
||||||
|
Top = 65
|
||||||
|
Width = 316
|
||||||
|
Align = alTop
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 38
|
||||||
|
ClientWidth = 316
|
||||||
|
TabOrder = 2
|
||||||
|
object CbSelectLockedCells: TCheckBox
|
||||||
|
Left = 8
|
||||||
|
Height = 19
|
||||||
|
Top = 0
|
||||||
|
Width = 300
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
Caption = 'select locked cells'
|
||||||
|
Checked = True
|
||||||
|
State = cbChecked
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object CbSelectUnlockedCells: TCheckBox
|
||||||
|
Left = 8
|
||||||
|
Height = 19
|
||||||
|
Top = 19
|
||||||
|
Width = 300
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
Caption = 'select unlocked cells'
|
||||||
|
Checked = True
|
||||||
|
State = cbChecked
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
87
applications/spready/sworksheetprotection.pas
Normal file
87
applications/spready/sworksheetprotection.pas
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
unit sWorksheetProtection;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel,
|
||||||
|
StdCtrls, ExtCtrls, CheckLst, fpsTypes;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TWorksheetProtectionForm }
|
||||||
|
|
||||||
|
TWorksheetProtectionForm = class(TForm)
|
||||||
|
TopBevel: TBevel;
|
||||||
|
ButtonPanel: TButtonPanel;
|
||||||
|
CbProtect: TCheckBox;
|
||||||
|
CbSelectLockedCells: TCheckBox;
|
||||||
|
CbSelectUnlockedCells: TCheckBox;
|
||||||
|
LblProtectionItems: TLabel;
|
||||||
|
ItemsPanel: TPanel;
|
||||||
|
procedure CbProtectChange(Sender: TObject);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
private
|
||||||
|
function GetProtected: Boolean;
|
||||||
|
function GetProtections: TsWorksheetProtections;
|
||||||
|
procedure SetProtected(AValue: Boolean);
|
||||||
|
procedure SetProtections(AValue: TsWorksheetProtections);
|
||||||
|
public
|
||||||
|
property IsProtected: Boolean read GetProtected write SetProtected;
|
||||||
|
property Protection: TsWorksheetProtections read GetProtections write SetProtections;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
WorksheetProtectionForm: TWorksheetProtectionForm;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
procedure TWorksheetProtectionForm.CbProtectChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
unlocked: Boolean;
|
||||||
|
begin
|
||||||
|
unlocked := not IsProtected;
|
||||||
|
LblProtectionItems.Enabled := unlocked;
|
||||||
|
CbSelectLockedCells.Enabled := unlocked;
|
||||||
|
CbSelectUnlockedCells.Enabled := unlocked;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TWorksheetProtectionForm.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Constraints.MinHeight := ItemsPanel.Height + CbProtect.Height +
|
||||||
|
TopBevel.Height + ButtonPanel.Height;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWorksheetProtectionForm.GetProtected: Boolean;
|
||||||
|
begin
|
||||||
|
Result := CbProtect.Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWorksheetProtectionForm.GetProtections: TsWorksheetProtections;
|
||||||
|
begin
|
||||||
|
Result := DEFAULT_SHEET_PROTECTION;
|
||||||
|
if CbSelectLockedCells.Checked then
|
||||||
|
Include(Result, spSelectLockedCells) else
|
||||||
|
Exclude(Result, spSelectLockedCells);
|
||||||
|
if CbSelectUnlockedCells.Checked then
|
||||||
|
Include(Result, spSelectUnlockedCells) else
|
||||||
|
Exclude(Result, spSelectUnlockedCells);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TWorksheetProtectionForm.SetProtected(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
CbProtect.Checked := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TWorksheetProtectionForm.SetProtections(AValue: TsWorksheetProtections);
|
||||||
|
begin
|
||||||
|
CbSelectLockedCells.Checked := spSelectLockedCells in AValue;
|
||||||
|
CbSelectUnlockedCells.Checked := spSelectUnlockedCells in AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user