You've already forked lazarus-ccr
fpspreadsheet: Add cell inspector to spready demo (shows properties of selected cell).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3489 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -4,7 +4,7 @@ object Form1: TForm1
|
|||||||
Top = 258
|
Top = 258
|
||||||
Width = 884
|
Width = 884
|
||||||
Caption = 'spready'
|
Caption = 'spready'
|
||||||
ClientHeight = 614
|
ClientHeight = 619
|
||||||
ClientWidth = 884
|
ClientWidth = 884
|
||||||
Menu = MainMenu
|
Menu = MainMenu
|
||||||
OnActivate = FormActivate
|
OnActivate = FormActivate
|
||||||
@ -14,7 +14,7 @@ object Form1: TForm1
|
|||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 78
|
Height = 78
|
||||||
Top = 536
|
Top = 541
|
||||||
Width = 884
|
Width = 884
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
@ -23,9 +23,9 @@ object Form1: TForm1
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object CbShowHeaders: TCheckBox
|
object CbShowHeaders: TCheckBox
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 24
|
Height = 19
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 116
|
Width = 93
|
||||||
Caption = 'Show headers'
|
Caption = 'Show headers'
|
||||||
Checked = True
|
Checked = True
|
||||||
OnClick = CbShowHeadersClick
|
OnClick = CbShowHeadersClick
|
||||||
@ -34,9 +34,9 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object CbShowGridLines: TCheckBox
|
object CbShowGridLines: TCheckBox
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 24
|
Height = 19
|
||||||
Top = 39
|
Top = 39
|
||||||
Width = 125
|
Width = 100
|
||||||
Caption = 'Show grid lines'
|
Caption = 'Show grid lines'
|
||||||
Checked = True
|
Checked = True
|
||||||
OnClick = CbShowGridLinesClick
|
OnClick = CbShowGridLinesClick
|
||||||
@ -45,7 +45,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object EdFrozenCols: TSpinEdit
|
object EdFrozenCols: TSpinEdit
|
||||||
Left = 645
|
Left = 645
|
||||||
Height = 28
|
Height = 23
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 52
|
Width = 52
|
||||||
OnChange = EdFrozenColsChange
|
OnChange = EdFrozenColsChange
|
||||||
@ -53,7 +53,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object EdFrozenRows: TSpinEdit
|
object EdFrozenRows: TSpinEdit
|
||||||
Left = 645
|
Left = 645
|
||||||
Height = 28
|
Height = 23
|
||||||
Top = 39
|
Top = 39
|
||||||
Width = 52
|
Width = 52
|
||||||
OnChange = EdFrozenRowsChange
|
OnChange = EdFrozenRowsChange
|
||||||
@ -61,37 +61,37 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
Left = 560
|
Left = 560
|
||||||
Height = 20
|
Height = 15
|
||||||
Top = 13
|
Top = 13
|
||||||
Width = 77
|
Width = 62
|
||||||
Caption = 'Frozen cols:'
|
Caption = 'Frozen cols:'
|
||||||
FocusControl = EdFrozenCols
|
FocusControl = EdFrozenCols
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label2: TLabel
|
object Label2: TLabel
|
||||||
Left = 560
|
Left = 560
|
||||||
Height = 20
|
Height = 15
|
||||||
Top = 40
|
Top = 40
|
||||||
Width = 82
|
Width = 66
|
||||||
Caption = 'Frozen rows:'
|
Caption = 'Frozen rows:'
|
||||||
FocusControl = EdFrozenRows
|
FocusControl = EdFrozenRows
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object CbReadFormulas: TCheckBox
|
object CbReadFormulas: TCheckBox
|
||||||
Left = 160
|
Left = 160
|
||||||
Height = 24
|
Height = 19
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 120
|
Width = 96
|
||||||
Caption = 'Read formulas'
|
Caption = 'Read formulas'
|
||||||
OnChange = CbReadFormulasChange
|
OnChange = CbReadFormulasChange
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object CbHeaderStyle: TComboBox
|
object CbHeaderStyle: TComboBox
|
||||||
Left = 408
|
Left = 408
|
||||||
Height = 28
|
Height = 23
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 116
|
Width = 116
|
||||||
ItemHeight = 20
|
ItemHeight = 15
|
||||||
ItemIndex = 2
|
ItemIndex = 2
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'Lazarus'
|
'Lazarus'
|
||||||
@ -105,9 +105,9 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object CbAutoCalcFormulas: TCheckBox
|
object CbAutoCalcFormulas: TCheckBox
|
||||||
Left = 160
|
Left = 160
|
||||||
Height = 24
|
Height = 19
|
||||||
Top = 39
|
Top = 39
|
||||||
Width = 158
|
Width = 128
|
||||||
Caption = 'Calculate on change'
|
Caption = 'Calculate on change'
|
||||||
OnChange = CbAutoCalcFormulasChange
|
OnChange = CbAutoCalcFormulasChange
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
@ -115,9 +115,9 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object PageControl1: TPageControl
|
object PageControl1: TPageControl
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 457
|
Height = 462
|
||||||
Top = 79
|
Top = 79
|
||||||
Width = 884
|
Width = 648
|
||||||
ActivePage = TabSheet1
|
ActivePage = TabSheet1
|
||||||
Align = alClient
|
Align = alClient
|
||||||
TabIndex = 0
|
TabIndex = 0
|
||||||
@ -125,13 +125,13 @@ object Form1: TForm1
|
|||||||
OnChange = PageControl1Change
|
OnChange = PageControl1Change
|
||||||
object TabSheet1: TTabSheet
|
object TabSheet1: TTabSheet
|
||||||
Caption = 'Sheet1'
|
Caption = 'Sheet1'
|
||||||
ClientHeight = 424
|
ClientHeight = 434
|
||||||
ClientWidth = 876
|
ClientWidth = 640
|
||||||
object WorksheetGrid: TsWorksheetGrid
|
object WorksheetGrid: TsWorksheetGrid
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 424
|
Height = 434
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 876
|
Width = 640
|
||||||
FrozenCols = 0
|
FrozenCols = 0
|
||||||
FrozenRows = 0
|
FrozenRows = 0
|
||||||
ReadFormulas = False
|
ReadFormulas = False
|
||||||
@ -145,7 +145,7 @@ object Form1: TForm1
|
|||||||
TitleStyle = tsNative
|
TitleStyle = tsNative
|
||||||
OnSelection = WorksheetGridSelection
|
OnSelection = WorksheetGridSelection
|
||||||
ColWidths = (
|
ColWidths = (
|
||||||
56
|
42
|
||||||
64
|
64
|
||||||
64
|
64
|
||||||
64
|
64
|
||||||
@ -263,19 +263,19 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object FontComboBox: TComboBox
|
object FontComboBox: TComboBox
|
||||||
Left = 52
|
Left = 52
|
||||||
Height = 28
|
Height = 23
|
||||||
Top = 2
|
Top = 2
|
||||||
Width = 127
|
Width = 127
|
||||||
ItemHeight = 20
|
ItemHeight = 15
|
||||||
OnSelect = FontComboBoxSelect
|
OnSelect = FontComboBoxSelect
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object FontSizeComboBox: TComboBox
|
object FontSizeComboBox: TComboBox
|
||||||
Left = 179
|
Left = 179
|
||||||
Height = 28
|
Height = 23
|
||||||
Top = 2
|
Top = 2
|
||||||
Width = 48
|
Width = 48
|
||||||
ItemHeight = 20
|
ItemHeight = 15
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'8'
|
'8'
|
||||||
'9'
|
'9'
|
||||||
@ -441,6 +441,69 @@ object Form1: TForm1
|
|||||||
Width = 5
|
Width = 5
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object InspectorSplitter: TSplitter
|
||||||
|
Left = 648
|
||||||
|
Height = 462
|
||||||
|
Top = 79
|
||||||
|
Width = 5
|
||||||
|
Align = alRight
|
||||||
|
ResizeAnchor = akRight
|
||||||
|
end
|
||||||
|
object InspectorPageControl: TPageControl
|
||||||
|
Left = 653
|
||||||
|
Height = 462
|
||||||
|
Top = 79
|
||||||
|
Width = 231
|
||||||
|
ActivePage = PgCellValue
|
||||||
|
Align = alRight
|
||||||
|
TabIndex = 0
|
||||||
|
TabOrder = 6
|
||||||
|
OnChange = InspectorPageControlChange
|
||||||
|
object PgCellValue: TTabSheet
|
||||||
|
Caption = 'Cell value'
|
||||||
|
ClientHeight = 434
|
||||||
|
ClientWidth = 223
|
||||||
|
object CellInspector: TValueListEditor
|
||||||
|
Left = 0
|
||||||
|
Height = 434
|
||||||
|
Top = 0
|
||||||
|
Width = 223
|
||||||
|
Align = alClient
|
||||||
|
FixedCols = 0
|
||||||
|
RowCount = 15
|
||||||
|
TabOrder = 0
|
||||||
|
TitleStyle = tsNative
|
||||||
|
DisplayOptions = [doColumnTitles, doAutoColResize]
|
||||||
|
Strings.Strings = (
|
||||||
|
'Row='
|
||||||
|
'Column='
|
||||||
|
'ContentType='
|
||||||
|
'NumberValue='
|
||||||
|
'DateTimeValue='
|
||||||
|
'UTF8StringValue='
|
||||||
|
'BoolValue='
|
||||||
|
'ErrorValue='
|
||||||
|
'RPNFormulaValue='
|
||||||
|
'StringFormula.FormulaStr='
|
||||||
|
'SharedFormulaBase='
|
||||||
|
''
|
||||||
|
''
|
||||||
|
''
|
||||||
|
)
|
||||||
|
TitleCaptions.Strings = (
|
||||||
|
''
|
||||||
|
''
|
||||||
|
)
|
||||||
|
ColWidths = (
|
||||||
|
109
|
||||||
|
110
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object PgProperties: TTabSheet
|
||||||
|
Caption = 'Properties'
|
||||||
|
end
|
||||||
|
end
|
||||||
object OpenDialog: TOpenDialog
|
object OpenDialog: TOpenDialog
|
||||||
DefaultExt = '.xls'
|
DefaultExt = '.xls'
|
||||||
Filter = 'Excel spreadsheet (*.xls)|*.xls|Excel XML spreadsheet (*.xlsx)|*.xlsx|LibreOffice/OpenOffice spreadsheet (*.ods)|*.ods|Wikitable (pipes) (.wikitable_pipes)|.wikitable_pipes|All files (*.*)|*.*'
|
Filter = 'Excel spreadsheet (*.xls)|*.xls|Excel XML spreadsheet (*.xlsx)|*.xlsx|LibreOffice/OpenOffice spreadsheet (*.ods)|*.ods|Wikitable (pipes) (.wikitable_pipes)|.wikitable_pipes|All files (*.*)|*.*'
|
||||||
@ -1162,6 +1225,13 @@ object Form1: TForm1
|
|||||||
AutoCheck = True
|
AutoCheck = True
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object mnuView: TMenuItem
|
||||||
|
Caption = 'View'
|
||||||
|
object mnuInspector: TMenuItem
|
||||||
|
Action = AcViewInspector
|
||||||
|
AutoCheck = True
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object ImageList: TImageList
|
object ImageList: TImageList
|
||||||
left = 272
|
left = 272
|
||||||
@ -2797,6 +2867,12 @@ object Form1: TForm1
|
|||||||
ImageIndex = 35
|
ImageIndex = 35
|
||||||
OnExecute = AcAddRowExecute
|
OnExecute = AcAddRowExecute
|
||||||
end
|
end
|
||||||
|
object AcViewInspector: TAction
|
||||||
|
AutoCheck = True
|
||||||
|
Caption = 'Inspector'
|
||||||
|
Checked = True
|
||||||
|
OnExecute = AcViewInspectorExecute
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object FontDialog: TFontDialog
|
object FontDialog: TFontDialog
|
||||||
MinFontSize = 0
|
MinFontSize = 0
|
||||||
|
@ -7,7 +7,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||||
StdCtrls, Menus, ExtCtrls, ComCtrls, ActnList, Spin, Grids,
|
StdCtrls, Menus, ExtCtrls, ComCtrls, ActnList, Spin, Grids,
|
||||||
ColorBox, fpspreadsheetgrid, fpspreadsheet, fpsallformats;
|
ColorBox, ValEdit, fpspreadsheetgrid, fpspreadsheet, fpsallformats;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -71,6 +71,7 @@ type
|
|||||||
AcNew: TAction;
|
AcNew: TAction;
|
||||||
AcAddColumn: TAction;
|
AcAddColumn: TAction;
|
||||||
AcAddRow: TAction;
|
AcAddRow: TAction;
|
||||||
|
AcViewInspector: TAction;
|
||||||
AcWordwrap: TAction;
|
AcWordwrap: TAction;
|
||||||
AcVAlignDefault: TAction;
|
AcVAlignDefault: TAction;
|
||||||
AcVAlignTop: TAction;
|
AcVAlignTop: TAction;
|
||||||
@ -152,6 +153,8 @@ type
|
|||||||
MenuItem64: TMenuItem;
|
MenuItem64: TMenuItem;
|
||||||
MenuItem65: TMenuItem;
|
MenuItem65: TMenuItem;
|
||||||
MenuItem66: TMenuItem;
|
MenuItem66: TMenuItem;
|
||||||
|
mnuInspector: TMenuItem;
|
||||||
|
mnuView: TMenuItem;
|
||||||
MnuFmtDateTimeMSZ: TMenuItem;
|
MnuFmtDateTimeMSZ: TMenuItem;
|
||||||
MnuTimeInterval: TMenuItem;
|
MnuTimeInterval: TMenuItem;
|
||||||
MnuShortTimeAM: TMenuItem;
|
MnuShortTimeAM: TMenuItem;
|
||||||
@ -196,6 +199,7 @@ type
|
|||||||
mnuSaveAs: TMenuItem;
|
mnuSaveAs: TMenuItem;
|
||||||
OpenDialog: TOpenDialog;
|
OpenDialog: TOpenDialog;
|
||||||
PageControl1: TPageControl;
|
PageControl1: TPageControl;
|
||||||
|
InspectorPageControl: TPageControl;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
BordersPopupMenu: TPopupMenu;
|
BordersPopupMenu: TPopupMenu;
|
||||||
NumFormatPopupMenu: TPopupMenu;
|
NumFormatPopupMenu: TPopupMenu;
|
||||||
@ -203,9 +207,13 @@ type
|
|||||||
EdFrozenCols: TSpinEdit;
|
EdFrozenCols: TSpinEdit;
|
||||||
FormulaToolBar: TToolBar;
|
FormulaToolBar: TToolBar;
|
||||||
FormulaToolbarSplitter: TSplitter;
|
FormulaToolbarSplitter: TSplitter;
|
||||||
|
InspectorSplitter: TSplitter;
|
||||||
|
PgCellValue: TTabSheet;
|
||||||
|
PgProperties: TTabSheet;
|
||||||
ToolButton22: TToolButton;
|
ToolButton22: TToolButton;
|
||||||
ToolButton23: TToolButton;
|
ToolButton23: TToolButton;
|
||||||
ToolButton27: TToolButton;
|
ToolButton27: TToolButton;
|
||||||
|
CellInspector: TValueListEditor;
|
||||||
WorksheetGrid: TsWorksheetGrid;
|
WorksheetGrid: TsWorksheetGrid;
|
||||||
TabSheet1: TTabSheet;
|
TabSheet1: TTabSheet;
|
||||||
ToolBar1: TToolBar;
|
ToolBar1: TToolBar;
|
||||||
@ -252,6 +260,7 @@ type
|
|||||||
procedure AcSaveAsExecute(Sender: TObject);
|
procedure AcSaveAsExecute(Sender: TObject);
|
||||||
procedure AcTextRotationExecute(Sender: TObject);
|
procedure AcTextRotationExecute(Sender: TObject);
|
||||||
procedure AcVertAlignmentExecute(Sender: TObject);
|
procedure AcVertAlignmentExecute(Sender: TObject);
|
||||||
|
procedure AcViewInspectorExecute(Sender: TObject);
|
||||||
procedure AcWordwrapExecute(Sender: TObject);
|
procedure AcWordwrapExecute(Sender: TObject);
|
||||||
procedure CbAutoCalcFormulasChange(Sender: TObject);
|
procedure CbAutoCalcFormulasChange(Sender: TObject);
|
||||||
procedure CbBackgroundColorSelect(Sender: TObject);
|
procedure CbBackgroundColorSelect(Sender: TObject);
|
||||||
@ -268,14 +277,17 @@ type
|
|||||||
procedure FontSizeComboBoxSelect(Sender: TObject);
|
procedure FontSizeComboBoxSelect(Sender: TObject);
|
||||||
procedure FormActivate(Sender: TObject);
|
procedure FormActivate(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure InspectorPageControlChange(Sender: TObject);
|
||||||
procedure PageControl1Change(Sender: TObject);
|
procedure PageControl1Change(Sender: TObject);
|
||||||
procedure WorksheetGridSelection(Sender: TObject; aCol, aRow: Integer);
|
procedure WorksheetGridSelection(Sender: TObject; aCol, aRow: Integer);
|
||||||
|
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
FCopiedFormat: TCell;
|
FCopiedFormat: TCell;
|
||||||
procedure LoadFile(const AFileName: String);
|
procedure LoadFile(const AFileName: String);
|
||||||
procedure SetupBackgroundColorBox;
|
procedure SetupBackgroundColorBox;
|
||||||
procedure UpdateBackgroundColorIndex;
|
procedure UpdateBackgroundColorIndex;
|
||||||
|
procedure UpdateCellInfo(ACell: PCell);
|
||||||
procedure UpdateFontNameIndex;
|
procedure UpdateFontNameIndex;
|
||||||
procedure UpdateFontSizeIndex;
|
procedure UpdateFontSizeIndex;
|
||||||
procedure UpdateFontStyleActions;
|
procedure UpdateFontStyleActions;
|
||||||
@ -294,6 +306,7 @@ var
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
StrUtils, TypInfo,
|
||||||
fpcanvas, fpsutils, fpsnumformatparser;
|
fpcanvas, fpsutils, fpsnumformatparser;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -518,6 +531,14 @@ end;
|
|||||||
procedure TForm1.AcNewExecute(Sender: TObject);
|
procedure TForm1.AcNewExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
WorksheetGrid.NewWorkbook(26, 100);
|
WorksheetGrid.NewWorkbook(26, 100);
|
||||||
|
|
||||||
|
WorksheetGrid.BeginUpdate;
|
||||||
|
try
|
||||||
|
WorksheetGrid.Col := WorksheetGrid.FixedCols;
|
||||||
|
WorksheetGrid.Row := WorksheetGrid.FixedRows;
|
||||||
|
finally
|
||||||
|
WorksheetGrid.EndUpdate;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.AcNumFormatExecute(Sender: TObject);
|
procedure TForm1.AcNumFormatExecute(Sender: TObject);
|
||||||
@ -600,6 +621,13 @@ begin
|
|||||||
UpdateVertAlignmentActions;
|
UpdateVertAlignmentActions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.AcViewInspectorExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
InspectorPageControl.Visible := AcViewInspector.Checked;
|
||||||
|
InspectorSplitter.Visible := AcViewInspector.Checked;
|
||||||
|
InspectorSplitter.Left := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.AcWordwrapExecute(Sender: TObject);
|
procedure TForm1.AcWordwrapExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
with WorksheetGrid do Wordwraps[Selection] := TAction(Sender).Checked;
|
with WorksheetGrid do Wordwraps[Selection] := TAction(Sender).Checked;
|
||||||
@ -772,6 +800,19 @@ begin
|
|||||||
CbBackgroundColor.DropDownCount := DROPDOWN_COUNT;
|
CbBackgroundColor.DropDownCount := DROPDOWN_COUNT;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.InspectorPageControlChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
r,c: Cardinal;
|
||||||
|
cell: PCell;
|
||||||
|
begin
|
||||||
|
CellInspector.Parent := InspectorPageControl.ActivePage;
|
||||||
|
|
||||||
|
r := WorksheetGrid.GetWorksheetRow(WorksheetGrid.Row);
|
||||||
|
c := WorksheetGrid.GetWorksheetCol(WorksheetGrid.Col);
|
||||||
|
cell := WorksheetGrid.Worksheet.FindCell(r, c);
|
||||||
|
UpdateCellInfo(cell);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.LoadFile(const AFileName: String);
|
procedure TForm1.LoadFile(const AFileName: String);
|
||||||
// Loads first worksheet from file into grid
|
// Loads first worksheet from file into grid
|
||||||
var
|
var
|
||||||
@ -886,6 +927,8 @@ begin
|
|||||||
UpdateTextRotationActions;
|
UpdateTextRotationActions;
|
||||||
UpdateNumFormatActions;
|
UpdateNumFormatActions;
|
||||||
|
|
||||||
|
UpdateCellInfo(cell);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.UpdateBackgroundColorIndex;
|
procedure TForm1.UpdateBackgroundColorIndex;
|
||||||
@ -913,6 +956,110 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.UpdateCellInfo(ACell: PCell);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
s: String;
|
||||||
|
cb: TsCellBorder;
|
||||||
|
begin
|
||||||
|
with CellInspector do begin
|
||||||
|
TitleCaptions[0] := 'Properties';
|
||||||
|
TitleCaptions[1] := 'Values';
|
||||||
|
Strings.Clear;
|
||||||
|
if InspectorPageControl.ActivePage = PgCellValue then
|
||||||
|
begin
|
||||||
|
if ACell=nil
|
||||||
|
then Strings.Add('Row=')
|
||||||
|
else Strings.Add(Format('Row=%d', [ACell^.Row]));
|
||||||
|
if ACell=nil
|
||||||
|
then Strings.Add('Column=')
|
||||||
|
else Strings.Add(Format('Column=%d', [ACell^.Col]));
|
||||||
|
if ACell=nil
|
||||||
|
then Strings.Add('ContentType=')
|
||||||
|
else Strings.Add(Format('ContentType=%s', [GetEnumName(TypeInfo(TCellContentType), ord(ACell^.ContentType))]));
|
||||||
|
if ACell=nil
|
||||||
|
then Strings.Add('NumberValue=')
|
||||||
|
else Strings.Add(Format('NumberValue=%g', [ACell^.NumberValue]));
|
||||||
|
if ACell=nil
|
||||||
|
then Strings.Add('DateTimeValue=')
|
||||||
|
else Strings.Add(Format('DateTimeValue=%g', [ACell^.DateTimeValue]));
|
||||||
|
if ACell=nil
|
||||||
|
then Strings.Add('UTF8StringValue=')
|
||||||
|
else Strings.Add(Format('UTF8StringValue=%s', [ACell^.UTF8StringValue]));
|
||||||
|
if ACell=nil
|
||||||
|
then Strings.Add('BoolValue=')
|
||||||
|
else Strings.Add(Format('BoolValue=%s', [BoolToStr(ACell^.BoolValue)]));
|
||||||
|
if ACell=nil
|
||||||
|
then Strings.Add('ErrorValue=')
|
||||||
|
else Strings.Add(Format('ErrorValue=%s', [
|
||||||
|
GetEnumName(TypeInfo(TsErrorValue), ord(ACell^.ErrorValue)) ]));
|
||||||
|
if (ACell=nil) or (Length(ACell^.RPNFormulaValue) = 0)
|
||||||
|
then Strings.Add('RPNFormulaValue=')
|
||||||
|
else Strings.Add(Format('RPNFormulaValue=(%d tokens)', [Length(ACell^.RPNFormulaValue)]));
|
||||||
|
if (ACell=nil) or (Length(ACell^.FormulaValue.FormulaStr)=0)
|
||||||
|
then Strings.Add('FormulaValue.FormulaStr=')
|
||||||
|
else Strings.Add(Format('FormulaValue.FormulaStr="%s"', [ACell^.FormulaValue.FormulaStr]));
|
||||||
|
if (ACell=nil) or (ACell^.SharedFormulaBase=nil)
|
||||||
|
then Strings.Add('SharedFormulaBase=')
|
||||||
|
else Strings.Add(Format('SharedFormulaBase=%s', [GetCellString(
|
||||||
|
ACell^.SharedFormulaBase^.Row, ACell^.SharedFormulaBase^.Col)]));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if (ACell=nil) or not (uffFont in ACell^.UsedFormattingFields)
|
||||||
|
then Strings.Add('FontIndex=')
|
||||||
|
else Strings.Add(Format('FontIndex=%d (%s(', [
|
||||||
|
ACell^.FontIndex,
|
||||||
|
WorksheetGrid.Workbook.GetFontAsString(ACell^.FontIndex)]));
|
||||||
|
if (ACell=nil) or not (uffTextRotation in ACell^.UsedFormattingFields)
|
||||||
|
then Strings.Add('TextRotation=')
|
||||||
|
else Strings.Add(Format('TextRotation=%s', [GetEnumName(TypeInfo(TsTextRotation), ord(ACell^.TextRotation))]));
|
||||||
|
if (ACell=nil) or not (uffHorAlign in ACell^.UsedFormattingFields)
|
||||||
|
then Strings.Add('HorAlignment=')
|
||||||
|
else Strings.Add(Format('HorAlignment=%s', [GetEnumName(TypeInfo(TsHorAlignment), ord(ACell^.HorAlignment))]));
|
||||||
|
if (ACell=nil) or not (uffVertAlign in ACell^.UsedFormattingFields)
|
||||||
|
then Strings.Add('VertAlignment=')
|
||||||
|
else Strings.Add(Format('VertAlignment=%s', [GetEnumName(TypeInfo(TsVertAlignment), ord(ACell^.VertAlignment))]));
|
||||||
|
if (ACell=nil) or not (uffBorder in ACell^.UsedFormattingFields) then
|
||||||
|
Strings.Add('Borders=')
|
||||||
|
else begin
|
||||||
|
s := '';
|
||||||
|
if cbNorth in ACell^.Border then s := s + ', cbNorth';
|
||||||
|
if cbSouth in ACell^.Border then s := s + ', cbSouth';
|
||||||
|
if cbEast in ACell^.Border then s := s + ', cbEast';
|
||||||
|
if cbWest in ACell^.Border then s := s + ', cbWest';
|
||||||
|
if cbDiagUp in ACell^.Border then s := s + ', cbDiagUp';
|
||||||
|
if cbDiagDown in ACell^.Border then s := s + ', cbDiagDown';
|
||||||
|
if s <> '' then Delete(s, 1, 2);
|
||||||
|
Strings.Add('Borders='+s);
|
||||||
|
end;
|
||||||
|
for cb in TsCellBorder do
|
||||||
|
if ACell=nil then
|
||||||
|
Strings.Add(Format('BorderStyles[%s]=', [
|
||||||
|
GetEnumName(TypeInfo(TsCellBorder), ord(cb))
|
||||||
|
]))
|
||||||
|
else
|
||||||
|
Strings.Add(Format('BorderStyles[%s]=%s, %s', [
|
||||||
|
GetEnumName(TypeInfo(TsCellBorder), ord(cb)),
|
||||||
|
GetEnumName(TypeInfo(TsLineStyle), ord(ACell^.BorderStyles[cbEast].LineStyle)),
|
||||||
|
WorksheetGrid.Workbook.GetColorName(ACell^.BorderStyles[cbEast].Color)
|
||||||
|
]));
|
||||||
|
if (ACell=nil) or not (uffBackgroundColor in ACell^.UsedformattingFields)
|
||||||
|
then Strings.Add('BackgroundColor=')
|
||||||
|
else Strings.Add(Format('BackgroundColor=%d (%s)', [
|
||||||
|
ACell^.BackgroundColor,
|
||||||
|
WorksheetGrid.Workbook.GetColorName(Acell^.BackgroundColor)
|
||||||
|
]));
|
||||||
|
if (ACell=nil) or not (uffNumberFormat in ACell^.UsedFormattingFields)
|
||||||
|
then Strings.Add('NumberFormat=')
|
||||||
|
else Strings.Add(Format('NumberFormat=%s', [GetEnumName(TypeInfo(TsNumberFormat), ord(ACell^.NumberFormat))]));
|
||||||
|
if (ACell=nil) or not (uffNumberFormat in ACell^.UsedFormattingFields)
|
||||||
|
then Strings.Add('NumberFormatStr=')
|
||||||
|
else Strings.Add('NumberFormatStr=' + ACell^.NumberFormatStr);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.UpdateFontNameIndex;
|
procedure TForm1.UpdateFontNameIndex;
|
||||||
var
|
var
|
||||||
fname: String;
|
fname: String;
|
||||||
|
@ -863,6 +863,7 @@ type
|
|||||||
function GetDefaultFont: TsFont;
|
function GetDefaultFont: TsFont;
|
||||||
function GetDefaultFontSize: Single;
|
function GetDefaultFontSize: Single;
|
||||||
function GetFont(AIndex: Integer): TsFont;
|
function GetFont(AIndex: Integer): TsFont;
|
||||||
|
function GetFontAsString(AIndex: Integer): String;
|
||||||
function GetFontCount: Integer;
|
function GetFontCount: Integer;
|
||||||
procedure InitFonts;
|
procedure InitFonts;
|
||||||
procedure RemoveAllFonts;
|
procedure RemoveAllFonts;
|
||||||
@ -5588,6 +5589,28 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{@@
|
||||||
|
Returns a string which identifies the font with a given index.
|
||||||
|
|
||||||
|
@param AIndex Index of the font
|
||||||
|
@return String with font name, font size etc.
|
||||||
|
}
|
||||||
|
function TsWorkbook.GetFontAsString(AIndex: Integer): String;
|
||||||
|
var
|
||||||
|
fnt: TsFont;
|
||||||
|
begin
|
||||||
|
fnt := GetFont(AIndex);
|
||||||
|
if fnt <> nil then begin
|
||||||
|
Result := Format('%s, size %.1f, color %s', [
|
||||||
|
fnt.FontName, fnt.Size, GetColorName(fnt.Color)]);
|
||||||
|
if (fssBold in fnt.Style) then Result := Result + ', bold';
|
||||||
|
if (fssItalic in fnt.Style) then Result := Result + ', italic';
|
||||||
|
if (fssUnderline in fnt.Style) then Result := Result + ', underline';
|
||||||
|
if (fssStrikeout in fnt.Style) then result := Result + ', strikeout';
|
||||||
|
end else
|
||||||
|
Result := '';
|
||||||
|
end;
|
||||||
|
|
||||||
{@@
|
{@@
|
||||||
Returns the count of registered fonts
|
Returns the count of registered fonts
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user