You've already forked lazarus-ccr
fpspreadsheet: Add actions for number format, word wrap and text direction.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3724 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -20,9 +20,35 @@ type
|
|||||||
ImageList: TImageList;
|
ImageList: TImageList;
|
||||||
MainMenu: TMainMenu;
|
MainMenu: TMainMenu;
|
||||||
MenuItem1: TMenuItem;
|
MenuItem1: TMenuItem;
|
||||||
|
MenuItem10: TMenuItem;
|
||||||
|
MenuItem11: TMenuItem;
|
||||||
|
MenuItem12: TMenuItem;
|
||||||
|
MenuItem13: TMenuItem;
|
||||||
|
MenuItem14: TMenuItem;
|
||||||
|
MenuItem15: TMenuItem;
|
||||||
|
MenuItem16: TMenuItem;
|
||||||
|
MenuItem17: TMenuItem;
|
||||||
|
MenuItem18: TMenuItem;
|
||||||
|
MenuItem19: TMenuItem;
|
||||||
MenuItem2: TMenuItem;
|
MenuItem2: TMenuItem;
|
||||||
|
MenuItem20: TMenuItem;
|
||||||
|
MenuItem21: TMenuItem;
|
||||||
|
MenuItem22: TMenuItem;
|
||||||
|
MenuItem23: TMenuItem;
|
||||||
|
MenuItem24: TMenuItem;
|
||||||
|
MenuItem25: TMenuItem;
|
||||||
|
MenuItem26: TMenuItem;
|
||||||
|
MenuItem27: TMenuItem;
|
||||||
|
MenuItem28: TMenuItem;
|
||||||
|
MenuItem29: TMenuItem;
|
||||||
MenuItem3: TMenuItem;
|
MenuItem3: TMenuItem;
|
||||||
|
MenuItem30: TMenuItem;
|
||||||
MenuItem4: TMenuItem;
|
MenuItem4: TMenuItem;
|
||||||
|
MenuItem5: TMenuItem;
|
||||||
|
MenuItem6: TMenuItem;
|
||||||
|
MenuItem7: TMenuItem;
|
||||||
|
MenuItem8: TMenuItem;
|
||||||
|
MenuItem9: TMenuItem;
|
||||||
MnuFile: TMenuItem;
|
MnuFile: TMenuItem;
|
||||||
MnuWorksheet: TMenuItem;
|
MnuWorksheet: TMenuItem;
|
||||||
MnuAddSheet: TMenuItem;
|
MnuAddSheet: TMenuItem;
|
||||||
@ -40,6 +66,30 @@ type
|
|||||||
AcHorAlignLeft: TsHorAlignmentAction;
|
AcHorAlignLeft: TsHorAlignmentAction;
|
||||||
AcHorAlignCenter: TsHorAlignmentAction;
|
AcHorAlignCenter: TsHorAlignmentAction;
|
||||||
AcHorAlignRight: TsHorAlignmentAction;
|
AcHorAlignRight: TsHorAlignmentAction;
|
||||||
|
AcTextRotHor: TsTextRotationAction;
|
||||||
|
AcTextRot90CW: TsTextRotationAction;
|
||||||
|
AcTextRot90CCW: TsTextRotationAction;
|
||||||
|
AcTextRotStacked: TsTextRotationAction;
|
||||||
|
AcWordWrap: TsWordwrapAction;
|
||||||
|
AcNumFormatFixed: TsNumberFormatAction;
|
||||||
|
AcNumFormatFixedTh: TsNumberFormatAction;
|
||||||
|
AcNumFormatPercentage: TsNumberFormatAction;
|
||||||
|
AcNumFormatCurrency: TsNumberFormatAction;
|
||||||
|
AcNumFormatCurrencyRed: TsNumberFormatAction;
|
||||||
|
PuTimeFormat: TPopupMenu;
|
||||||
|
PuDateFormat: TPopupMenu;
|
||||||
|
PuCurrencyFormat: TPopupMenu;
|
||||||
|
PuNumFormat: TPopupMenu;
|
||||||
|
AcNumFormatGeneral: TsNumberFormatAction;
|
||||||
|
AcNumFormatExp: TsNumberFormatAction;
|
||||||
|
AcNumFormatDateTime: TsNumberFormatAction;
|
||||||
|
AcNumFormatLongDate: TsNumberFormatAction;
|
||||||
|
AcNumFormatShortDate: TsNumberFormatAction;
|
||||||
|
AcNumFormatLongTime: TsNumberFormatAction;
|
||||||
|
AcNumFormatShortTime: TsNumberFormatAction;
|
||||||
|
AcNumFormatLongTimeAM: TsNumberFormatAction;
|
||||||
|
AcNumFormatShortTimeAM: TsNumberFormatAction;
|
||||||
|
AcNumFormatTimeInterval: TsNumberFormatAction;
|
||||||
ToolButton11: TToolButton;
|
ToolButton11: TToolButton;
|
||||||
ToolButton12: TToolButton;
|
ToolButton12: TToolButton;
|
||||||
ToolButton13: TToolButton;
|
ToolButton13: TToolButton;
|
||||||
@ -61,6 +111,12 @@ type
|
|||||||
ToolButton1: TToolButton;
|
ToolButton1: TToolButton;
|
||||||
ToolButton10: TToolButton;
|
ToolButton10: TToolButton;
|
||||||
ToolButton2: TToolButton;
|
ToolButton2: TToolButton;
|
||||||
|
ToolButton20: TToolButton;
|
||||||
|
ToolButton21: TToolButton;
|
||||||
|
ToolButton22: TToolButton;
|
||||||
|
ToolButton23: TToolButton;
|
||||||
|
ToolButton24: TToolButton;
|
||||||
|
ToolButton25: TToolButton;
|
||||||
ToolButton3: TToolButton;
|
ToolButton3: TToolButton;
|
||||||
ToolButton4: TToolButton;
|
ToolButton4: TToolButton;
|
||||||
ToolButton5: TToolButton;
|
ToolButton5: TToolButton;
|
||||||
|
@ -4,7 +4,7 @@ object Form1: TForm1
|
|||||||
Top = 177
|
Top = 177
|
||||||
Width = 874
|
Width = 874
|
||||||
Caption = 'Form1'
|
Caption = 'Form1'
|
||||||
ClientHeight = 508
|
ClientHeight = 503
|
||||||
ClientWidth = 874
|
ClientWidth = 874
|
||||||
Menu = MainMenu
|
Menu = MainMenu
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
@ -126,10 +126,10 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object CbLoader: TComboBox
|
object CbLoader: TComboBox
|
||||||
Left = 104
|
Left = 104
|
||||||
Height = 23
|
Height = 28
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 148
|
Width = 148
|
||||||
ItemHeight = 15
|
ItemHeight = 20
|
||||||
ItemIndex = 1
|
ItemIndex = 1
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'Workbook'
|
'Workbook'
|
||||||
@ -142,16 +142,16 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
Left = 13
|
Left = 13
|
||||||
Height = 15
|
Height = 20
|
||||||
Top = 11
|
Top = 11
|
||||||
Width = 58
|
Width = 73
|
||||||
Caption = 'Loaded by:'
|
Caption = 'Loaded by:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object InspectorTabControl: TTabControl
|
object InspectorTabControl: TTabControl
|
||||||
Left = 577
|
Left = 577
|
||||||
Height = 408
|
Height = 403
|
||||||
Top = 100
|
Top = 100
|
||||||
Width = 297
|
Width = 297
|
||||||
OnChange = InspectorTabControlChange
|
OnChange = InspectorTabControlChange
|
||||||
@ -167,7 +167,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object Splitter1: TSplitter
|
object Splitter1: TSplitter
|
||||||
Left = 572
|
Left = 572
|
||||||
Height = 408
|
Height = 403
|
||||||
Top = 100
|
Top = 100
|
||||||
Width = 5
|
Width = 5
|
||||||
Align = alRight
|
Align = alRight
|
||||||
@ -328,6 +328,93 @@ object Form1: TForm1
|
|||||||
Caption = 'New Item21'
|
Caption = 'New Item21'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object MnuTextRotation: TMenuItem
|
||||||
|
Caption = 'Text rotation'
|
||||||
|
object MnuTextRotHor: TMenuItem
|
||||||
|
Caption = 'New Item24'
|
||||||
|
end
|
||||||
|
object MnuTextRot90CW: TMenuItem
|
||||||
|
Caption = 'New Item25'
|
||||||
|
end
|
||||||
|
object MnuTextRot90CCW: TMenuItem
|
||||||
|
Caption = 'New Item26'
|
||||||
|
end
|
||||||
|
object MnuTextRotStacked: TMenuItem
|
||||||
|
Caption = 'New Item27'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object MnuNumberFormat: TMenuItem
|
||||||
|
Caption = 'Number format'
|
||||||
|
object MnuNumFormatGeneral: TMenuItem
|
||||||
|
Caption = 'New Item29'
|
||||||
|
end
|
||||||
|
object MenuItem3: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object MnuNumFormatFixed: TMenuItem
|
||||||
|
Caption = 'New Item31'
|
||||||
|
end
|
||||||
|
object MnuNumFormatFixedTh: TMenuItem
|
||||||
|
Caption = 'New Item32'
|
||||||
|
end
|
||||||
|
object MnuNumFormatExp: TMenuItem
|
||||||
|
Caption = 'New Item33'
|
||||||
|
end
|
||||||
|
object MnuNumFormatPercentage: TMenuItem
|
||||||
|
Caption = 'New Item34'
|
||||||
|
end
|
||||||
|
object MenuItem8: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object MnuNumFormatCurrency: TMenuItem
|
||||||
|
Caption = 'New Item36'
|
||||||
|
end
|
||||||
|
object MnuNumFormatCurrencyRed: TMenuItem
|
||||||
|
Caption = 'New Item37'
|
||||||
|
end
|
||||||
|
object MenuItem4: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object MnuNumFormatShortDateTime: TMenuItem
|
||||||
|
Caption = 'New Item39'
|
||||||
|
end
|
||||||
|
object MenuItem2: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object MnuNumFormatLongDate: TMenuItem
|
||||||
|
Caption = 'New Item41'
|
||||||
|
end
|
||||||
|
object MnuNumFormatShortDate: TMenuItem
|
||||||
|
Caption = 'New Item42'
|
||||||
|
end
|
||||||
|
object MenuItem1: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object MnuNumFormatLongTime: TMenuItem
|
||||||
|
Caption = 'New Item44'
|
||||||
|
end
|
||||||
|
object MnuNumFormatShortTime: TMenuItem
|
||||||
|
Caption = 'New Item45'
|
||||||
|
end
|
||||||
|
object MenuItem5: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object MnuNumFormatLongTimeAM: TMenuItem
|
||||||
|
Caption = 'New Item47'
|
||||||
|
end
|
||||||
|
object MnuNumFormatShortTimeAM: TMenuItem
|
||||||
|
Caption = 'New Item48'
|
||||||
|
end
|
||||||
|
object MenuItem6: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object MnuNumFormatTimeInterval: TMenuItem
|
||||||
|
Caption = 'New Item50'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object MnuWordwrap: TMenuItem
|
||||||
|
Caption = 'New Item23'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -21,6 +21,35 @@ type
|
|||||||
ImageList1: TImageList;
|
ImageList1: TImageList;
|
||||||
Label1: TLabel;
|
Label1: TLabel;
|
||||||
MainMenu: TMainMenu;
|
MainMenu: TMainMenu;
|
||||||
|
MenuItem1: TMenuItem;
|
||||||
|
MenuItem5: TMenuItem;
|
||||||
|
MenuItem6: TMenuItem;
|
||||||
|
MnuNumFormatTimeInterval: TMenuItem;
|
||||||
|
MnuNumFormatLongTimeAM: TMenuItem;
|
||||||
|
MnuNumFormatShortTimeAM: TMenuItem;
|
||||||
|
MnuNumFormatLongTime: TMenuItem;
|
||||||
|
MnuNumFormatShortTime: TMenuItem;
|
||||||
|
MnuNumFormatShortDateTime: TMenuItem;
|
||||||
|
MenuItem2: TMenuItem;
|
||||||
|
MnuNumFormatLongDate: TMenuItem;
|
||||||
|
MnuNumFormatShortDate: TMenuItem;
|
||||||
|
MnuNumFormatCurrency: TMenuItem;
|
||||||
|
MnuNumFormatCurrencyRed: TMenuItem;
|
||||||
|
MenuItem4: TMenuItem;
|
||||||
|
MnuNumberFormat: TMenuItem;
|
||||||
|
MnuNumFormatGeneral: TMenuItem;
|
||||||
|
MenuItem3: TMenuItem;
|
||||||
|
MnuNumFormatFixed: TMenuItem;
|
||||||
|
MnuNumFormatFixedTh: TMenuItem;
|
||||||
|
MnuNumFormatExp: TMenuItem;
|
||||||
|
MnuNumFormatPercentage: TMenuItem;
|
||||||
|
MenuItem8: TMenuItem;
|
||||||
|
MnuTextRotHor: TMenuItem;
|
||||||
|
MnuTextRot90CW: TMenuItem;
|
||||||
|
MnuTextRot90CCW: TMenuItem;
|
||||||
|
MnuTextRotStacked: TMenuItem;
|
||||||
|
MnuTextRotation: TMenuItem;
|
||||||
|
MnuWordwrap: TMenuItem;
|
||||||
MnuVertAlignTop: TMenuItem;
|
MnuVertAlignTop: TMenuItem;
|
||||||
MnuVertAlignCenter: TMenuItem;
|
MnuVertAlignCenter: TMenuItem;
|
||||||
MnuVertAlignBottom: TMenuItem;
|
MnuVertAlignBottom: TMenuItem;
|
||||||
@ -295,6 +324,168 @@ begin
|
|||||||
MnuVertAlignBottom.Action := actn;
|
MnuVertAlignBottom.Action := actn;
|
||||||
TbVertAlignBottom.Action := Actn;
|
TbVertAlignBottom.Action := Actn;
|
||||||
|
|
||||||
|
{ Text rotation }
|
||||||
|
actn := TsTextRotationAction.Create(self);
|
||||||
|
with TsTextRotationAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
TextRotation := trHorizontal;
|
||||||
|
end;
|
||||||
|
MnuTextRotHor.Action := actn;
|
||||||
|
|
||||||
|
actn := TsTextRotationAction.Create(self);
|
||||||
|
with TsTextRotationAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
TextRotation := rt90DegreeClockwiseRotation;
|
||||||
|
end;
|
||||||
|
MnuTextRot90CW.Action := actn;
|
||||||
|
|
||||||
|
actn := TsTextRotationAction.Create(self);
|
||||||
|
with TsTextRotationAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
TextRotation := rt90DegreeCounterClockwiseRotation;
|
||||||
|
end;
|
||||||
|
MnuTextRot90CCW.Action := actn;
|
||||||
|
|
||||||
|
actn := TsTextRotationAction.Create(self);
|
||||||
|
with TsTextRotationAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
TextRotation := rtStacked;
|
||||||
|
end;
|
||||||
|
MnuTextRotStacked.Action := actn;
|
||||||
|
|
||||||
|
{ Word wrap }
|
||||||
|
actn := TsWordwrapAction.Create(self);
|
||||||
|
with TsWordwrapAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
Wordwrap := false;
|
||||||
|
end;
|
||||||
|
MnuWordwrap.Action := actn;
|
||||||
|
|
||||||
|
{ Number format }
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfGeneral;
|
||||||
|
end;
|
||||||
|
MnuNumFormatGeneral.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfFixed;
|
||||||
|
end;
|
||||||
|
MnuNumFormatFixed.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfFixedTh;
|
||||||
|
end;
|
||||||
|
MnuNumFormatFixedTh.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfExp;
|
||||||
|
end;
|
||||||
|
MnuNumFormatExp.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfPercentage;
|
||||||
|
end;
|
||||||
|
MnuNumFormatPercentage.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfCurrency;
|
||||||
|
end;
|
||||||
|
MnuNumFormatCurrency.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfCurrencyRed;
|
||||||
|
end;
|
||||||
|
MnuNumFormatCurrencyRed.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfShortDateTime;
|
||||||
|
end;
|
||||||
|
MnuNumFormatShortDateTime.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfLongDate;
|
||||||
|
end;
|
||||||
|
MnuNumFormatLongDate.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfShortDate;
|
||||||
|
end;
|
||||||
|
MnuNumFormatShortDate.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfLongTime;
|
||||||
|
end;
|
||||||
|
MnuNumFormatLongTime.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfShortTime;
|
||||||
|
end;
|
||||||
|
MnuNumFormatShortTime.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfLongTimeAM;
|
||||||
|
end;
|
||||||
|
MnuNumFormatLongTimeAM.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfShortTimeAM;
|
||||||
|
end;
|
||||||
|
MnuNumFormatShortTimeAM.Action := actn;
|
||||||
|
|
||||||
|
actn := TsNumberFormatAction.Create(self);
|
||||||
|
with TsNumberFormatAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
NumberFormat := nfTimeInterval;
|
||||||
|
end;
|
||||||
|
MnuNumFormatTimeInterval.Action := actn;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.InspectorTabControlChange(Sender: TObject);
|
procedure TForm1.InspectorTabControlChange(Sender: TObject);
|
||||||
|
@ -133,7 +133,8 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
published
|
published
|
||||||
property FontStyle: TsFontStyle read FFontStyle write SetFontStyle;
|
property FontStyle: TsFontStyle
|
||||||
|
read FFontStyle write SetFontStyle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -149,7 +150,8 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
published
|
published
|
||||||
property HorAlignment: TsHorAlignment read FHorAlign write SetHorAlign;
|
property HorAlignment: TsHorAlignment
|
||||||
|
read FHorAlign write SetHorAlign default haDefault;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -165,24 +167,83 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
published
|
published
|
||||||
property VertAlignment: TsVertAlignment read FVertAlign write SetVertAlign;
|
property VertAlignment: TsVertAlignment
|
||||||
|
read FVertAlign write SetVertAlign default vaDefault;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsTextRotationAction }
|
||||||
|
|
||||||
|
TsTextRotationAction = class(TsCellFormatAction)
|
||||||
|
private
|
||||||
|
FTextRotation: TsTextRotation;
|
||||||
|
procedure SetTextRotation(AValue: TsTextRotation);
|
||||||
|
protected
|
||||||
|
procedure ApplyFormatToCell(ACell: PCell); override;
|
||||||
|
procedure ExtractFromCell(ACell: PCell); override;
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
published
|
||||||
|
property TextRotation: TsTextRotation
|
||||||
|
read FTextRotation write SetTextRotation default trHorizontal;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsWordwrapAction }
|
||||||
|
|
||||||
|
TsWordwrapAction = class(TsCellFormatAction)
|
||||||
|
private
|
||||||
|
function GetWordwrap: Boolean;
|
||||||
|
procedure SetWordwrap(AValue: Boolean);
|
||||||
|
protected
|
||||||
|
procedure ApplyFormatToCell(ACell: PCell); override;
|
||||||
|
procedure ExtractFromCell(ACell: PCell); override;
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
published
|
||||||
|
property Wordwrap: boolean
|
||||||
|
read GetWordwrap write SetWordwrap default false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsNumberFormatAction }
|
||||||
|
|
||||||
|
TsNumberFormatAction = class(TsCellFormatAction)
|
||||||
|
private
|
||||||
|
FNumberFormat: TsNumberFormat;
|
||||||
|
FNumberFormatStr: string;
|
||||||
|
procedure SetNumberFormat(AValue: TsNumberFormat);
|
||||||
|
procedure SetNumberFormatStr(AValue: String);
|
||||||
|
protected
|
||||||
|
procedure ApplyFormatToCell(ACell: PCell); override;
|
||||||
|
procedure ExtractFromCell(ACell: PCell); override;
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
published
|
||||||
|
property NumberFormat: TsNumberFormat
|
||||||
|
read FNumberFormat write SetNumberFormat default nfGeneral;
|
||||||
|
property NumberFormatString: string
|
||||||
|
read FNumberFormatStr write SetNumberFormatStr;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Dialogs;
|
Dialogs,
|
||||||
|
fpsutils;
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
begin
|
begin
|
||||||
RegisterActions('FPSpreadsheet', [
|
RegisterActions('FPSpreadsheet', [
|
||||||
|
// Worksheet-releated actions
|
||||||
TsWorksheetAddAction, TsWorksheetDeleteAction, TsWorksheetRenameAction,
|
TsWorksheetAddAction, TsWorksheetDeleteAction, TsWorksheetRenameAction,
|
||||||
|
// Cell or cell range formatting actions
|
||||||
TsFontStyleAction,
|
TsFontStyleAction,
|
||||||
TsHorAlignmentAction, TsVertAlignmentAction
|
TsHorAlignmentAction, TsVertAlignmentAction,
|
||||||
|
TsTextRotationAction, TsWordWrapAction, TsNumberFormatAction
|
||||||
], nil);
|
], nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -550,4 +611,161 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsTextRotationAction }
|
||||||
|
|
||||||
|
constructor TsTextRotationAction.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
GroupIndex := 1411141108; // Date/time when this was written
|
||||||
|
AutoCheck := true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsTextRotationAction.ApplyFormatToCell(ACell: PCell);
|
||||||
|
begin
|
||||||
|
if Checked then
|
||||||
|
Worksheet.WriteTextRotation(ACell, FTextRotation)
|
||||||
|
else
|
||||||
|
Worksheet.WriteTextRotation(ACell, trHorizontal);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsTextRotationAction.ExtractFromCell(ACell: PCell);
|
||||||
|
begin
|
||||||
|
if (ACell = nil) or not (uffTextRotation in ACell^.UsedFormattingFields) then
|
||||||
|
Checked := false
|
||||||
|
else
|
||||||
|
Checked := ACell^.TextRotation = FTextRotation;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsTextRotationAction.SetTextRotation(AValue: TsTextRotation);
|
||||||
|
begin
|
||||||
|
FTextRotation := AValue;
|
||||||
|
case FTextRotation of
|
||||||
|
trHorizontal:
|
||||||
|
begin Caption := 'Horizontal'; Hint := 'Horizontal text'; end;
|
||||||
|
rt90DegreeClockwiseRotation:
|
||||||
|
begin Caption := '90° clockwise'; Hint := '90° clockwise rotated text'; end;
|
||||||
|
rt90DegreeCounterClockwiseRotation:
|
||||||
|
begin Caption := '90° counter-clockwise'; Hint := '90° counter-clockwise rotated text'; end;
|
||||||
|
rtStacked:
|
||||||
|
begin Caption := 'Stacked'; Hint := 'Vertically stacked horizontal letters'; end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsWordwrapAction }
|
||||||
|
|
||||||
|
constructor TsWordwrapAction.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
AutoCheck := true;
|
||||||
|
Caption := 'Word-wrap';
|
||||||
|
Hint := 'Word-wrapped text';
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsWordwrapAction.ApplyFormatToCell(ACell: PCell);
|
||||||
|
begin
|
||||||
|
Worksheet.WriteWordwrap(ACell, Checked);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsWordwrapAction.ExtractFromCell(ACell: PCell);
|
||||||
|
begin
|
||||||
|
Checked := (ACell <> nil) and (uffWordwrap in ACell^.UsedFormattingFields);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TsWordwrapAction.GetWordwrap: Boolean;
|
||||||
|
begin
|
||||||
|
Result := Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsWordwrapAction.SetWordwrap(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
Checked := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsNumberFormatAction }
|
||||||
|
|
||||||
|
constructor TsNumberFormatAction.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
GroupIndex := 1411141258; // Date/time when this was written
|
||||||
|
AutoCheck := true;
|
||||||
|
Caption := 'Number format';
|
||||||
|
Hint := 'Number format';
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsNumberFormatAction.ApplyFormatToCell(ACell: PCell);
|
||||||
|
var
|
||||||
|
nf: TsNumberFormat;
|
||||||
|
nfstr: String;
|
||||||
|
begin
|
||||||
|
if Checked then
|
||||||
|
begin
|
||||||
|
nf := FNumberFormat;
|
||||||
|
nfstr := FNumberFormatStr;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
nf := nfGeneral;
|
||||||
|
nfstr := '';
|
||||||
|
end;
|
||||||
|
if IsDateTimeFormat(nf) then
|
||||||
|
Worksheet.WriteDateTimeFormat(ACell, nf, nfstr)
|
||||||
|
else
|
||||||
|
Worksheet.WriteNumberFormat(ACell, nf, nfstr);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsNumberFormatAction.ExtractFromCell(ACell: PCell);
|
||||||
|
begin
|
||||||
|
if (ACell = nil) or not (uffNumberFormat in ACell^.UsedFormattingFields) then
|
||||||
|
Checked := false
|
||||||
|
else
|
||||||
|
Checked := (ACell^.NumberFormat = FNumberFormat)
|
||||||
|
and (ACell^.NumberFormatStr = FNumberFormatStr);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsNumberFormatAction.SetNumberFormat(AValue: TsNumberFormat);
|
||||||
|
begin
|
||||||
|
FNumberFormat := AValue;
|
||||||
|
case FNumberFormat of
|
||||||
|
nfGeneral:
|
||||||
|
begin Caption := 'General'; Hint := 'General format'; end;
|
||||||
|
nfFixed:
|
||||||
|
begin Caption := 'Fixed'; Hint := 'Fixed decimals format'; end;
|
||||||
|
nfFixedTh:
|
||||||
|
begin Caption := 'Fixed w/thousand separator'; Hint := 'Fixed decimal count with thousand separator'; end;
|
||||||
|
nfExp:
|
||||||
|
begin Caption := 'Exponential'; Hint := 'Exponential format'; end;
|
||||||
|
nfPercentage:
|
||||||
|
begin Caption := 'Percent'; Hint := 'Percent format'; end;
|
||||||
|
nfCurrency:
|
||||||
|
begin Caption := 'Currency'; Hint := 'Currency format'; end;
|
||||||
|
nfCurrencyRed:
|
||||||
|
begin Caption := 'Currency (red)'; Hint := 'Currency format (negative values in red)'; end;
|
||||||
|
nfShortDateTime:
|
||||||
|
begin Caption := 'Date/time'; Hint := 'Date and time'; end;
|
||||||
|
nfShortDate:
|
||||||
|
begin Caption := 'Short date'; Hint := 'Short date format'; end;
|
||||||
|
nfLongDate:
|
||||||
|
begin Caption := 'Long date'; Hint := 'Long date format'; end;
|
||||||
|
nfShortTime:
|
||||||
|
begin Caption := 'Short time'; Hint := 'Short time format'; end;
|
||||||
|
nfLongTime:
|
||||||
|
begin Caption := 'Long time'; Hint := 'Long time foramt'; end;
|
||||||
|
nfShortTimeAM:
|
||||||
|
begin Caption := 'Short time AM/PM'; Hint := 'Short 12-hour time format'; end;
|
||||||
|
nfLongTimeAM:
|
||||||
|
begin Caption := 'Long time AM/PM'; Hint := 'Long 12-hour time format'; end;
|
||||||
|
nfTimeInterval:
|
||||||
|
begin Caption := 'Time interval'; Hint := 'Time interval format'; end;
|
||||||
|
nfCustom:
|
||||||
|
begin Caption := 'Custom'; Hint := 'User-defined custom format'; end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsNumberFormatAction.SetNumberFormatStr(AValue: String);
|
||||||
|
begin
|
||||||
|
FNumberFormatStr := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -1094,8 +1094,11 @@ begin
|
|||||||
nfPercentage:
|
nfPercentage:
|
||||||
Result := '0' + decs + '%';
|
Result := '0' + decs + '%';
|
||||||
nfCurrency, nfCurrencyRed:
|
nfCurrency, nfCurrencyRed:
|
||||||
raise Exception.Create('BuildNumberFormatString: Use BuildCurrencyFormatString '+
|
Result := BuildCurrencyFormatString(nfdDefault, ANumberFormat, AFormatSettings,
|
||||||
'to create a format string for currency values.');
|
ADecimals, AFormatSettings.CurrencyFormat, AFormatSettings.NegCurrFormat,
|
||||||
|
AFormatSettings.CurrencyString);
|
||||||
|
// raise Exception.Create('BuildNumberFormatString: Use BuildCurrencyFormatString '+
|
||||||
|
// 'to create a format string for currency values.');
|
||||||
nfShortDateTime, nfShortDate, nfLongDate, nfShortTime, nfLongTime,
|
nfShortDateTime, nfShortDate, nfLongDate, nfShortTime, nfLongTime,
|
||||||
nfShortTimeAM, nfLongTimeAM, nfTimeInterval:
|
nfShortTimeAM, nfLongTimeAM, nfTimeInterval:
|
||||||
raise Exception.Create('BuildNumberFormatString: Use BuildDateTimeFormatSstring '+
|
raise Exception.Create('BuildNumberFormatString: Use BuildDateTimeFormatSstring '+
|
||||||
|
Reference in New Issue
Block a user