Update chm help (add help for fpspreadsheetctrls and fpspreadsheetgrid).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8001 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-04-16 23:02:30 +00:00
parent 5b0b5f8f6f
commit f190ffd0b5
10 changed files with 254 additions and 255 deletions

View File

@ -1,5 +1,3 @@
set pasdoc_cmd=pasdoc.exe set pasdoc_cmd=pasdoc.exe
set hhc_cmd="C:\Program Files (x86)\HTML Help Workshop\hhc.exe"
%pasdoc_cmd% @options.txt --format=htmlhelp --output=output --name=fpspreadsheet --source=source-files.txt %pasdoc_cmd% @options.txt --format=htmlhelp --output=output --name=fpspreadsheet --source=source-files.txt
::%hhc_cmd% output\fpspreadsheet.hhc

View File

@ -148,9 +148,15 @@ td.itemunit {white-space:nowrap; }
td.itemdesc { width:100%; } td.itemdesc { width:100%; }
div.nodescription { color:red; } div.nodescription { color:red; }
dl.parameters dt {
font-family: monospace;
font-size:1.0em;
}
/*
dl.parameters dt { dl.parameters dt {
color:blue; color:blue;
} }
*/
code { code {
font-family: monospace; font-family: monospace;

View File

@ -0,0 +1,4 @@
::set chm_cmd="C:\Program Files (x86)\HTML Help Workshop\hhc.exe"
set chm_cmd=chmcmd.exe
%chm_cmd% output\fpspreadsheet.hhp

View File

@ -5,3 +5,5 @@
../../source/common/fpsnumformat.pas ../../source/common/fpsnumformat.pas
../../source/common/fpsallformats.pas ../../source/common/fpsallformats.pas
../../source/common/fpsrpn.pas ../../source/common/fpsrpn.pas
../../source/visual/fpspreadsheetctrls.pas
../../source/visual/fpspreadsheetgrid.pas

View File

@ -13,7 +13,6 @@ mimetype - application/vnd.oasis.opendocument.spreadsheet
META-INF\manifest.xml - Describes the other files in the archive META-INF\manifest.xml - Describes the other files in the archive
Specifications obtained from: Specifications obtained from:
http://docs.oasis-open.org/office/v1.1/OS/OpenDocument-v1.1.pdf http://docs.oasis-open.org/office/v1.1/OS/OpenDocument-v1.1.pdf
AUTHORS: Felipe Monteiro de Carvalho / Jose Luis Jurado Rincon / Werner Pamler AUTHORS: Felipe Monteiro de Carvalho / Jose Luis Jurado Rincon / Werner Pamler

View File

@ -202,9 +202,8 @@ end;
Excel-style address, e.g. A1:G5. As in Excel, use a $ sign to indicate Excel-style address, e.g. A1:G5. As in Excel, use a $ sign to indicate
absolute addresses. absolute addresses.
@param ACellRangeAddress Adress of the cell range given in Excel notation, @param ACellRangeAddress Adress of the cell range given in Excel notation, such as A1:G5
such as A1:G5 @param ANext Pointer to the next RPN item in the list
@param ANext Pointer to the next RPN item in the list
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function RPNCellRange(ACellRangeAddress: String; ANext: PRPNItem): PRPNItem; function RPNCellRange(ACellRangeAddress: String; ANext: PRPNItem): PRPNItem;
var var
@ -386,8 +385,9 @@ end;
(--> TFEKind). Note that array elements for all needed parameters must have (--> TFEKind). Note that array elements for all needed parameters must have
been created before. been created before.
@param AToken Formula element indicating the function to be executed, see the @link(TFEKind) enumeration for possible values. @param(AToken Formula element indicating the function to be executed, see
@param ANext Pointer to the next RPN item in the list the @link(TFEKind) enumeration for possible values.)
@param(ANext Pointer to the next RPN item in the list)
@seeAlso TFEKind @seeAlso TFEKind
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
@ -449,9 +449,12 @@ end;
nil)))); nil))));
) )
@param AItem Pointer to the first RPN item representing the formula. Each item contains a pointer to the next item in the list. The list is terminated by nil. @param(AItem Pointer to the first RPN item representing the formula.
@param AReverse If @true the first rpn item in the chained list becomes the last item in the token array. This feature is needed for reading an xls file. Each item contains a pointer to the next item in the list.
The list is terminated by nil.)
@param(AReverse If @true the first rpn item in the chained list becomes the
last item in the token array. This feature is needed for
reading an xls file.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function CreateRPNFormula(AItem: PRPNItem; AReverse: Boolean = false): TsRPNFormula; function CreateRPNFormula(AItem: PRPNItem; AReverse: Boolean = false): TsRPNFormula;
var var
@ -487,7 +490,9 @@ end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Destroys the RPN formula starting with the given RPN item. Destroys the RPN formula starting with the given RPN item.
@param AItem Pointer to the first RPN items representing the formula. Each item contains a pointer to the next item in the list. The list is terminated by nil. @param(AItem Pointer to the first RPN items representing the formula.
Each item contains a pointer to the next item in the list.
The list is terminated by nil.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure DestroyRPNFormula(AItem: PRPNItem); procedure DestroyRPNFormula(AItem: PRPNItem);
var var

View File

@ -6,7 +6,7 @@
AUTHORS: Werner Pamler AUTHORS: Werner Pamler
LICENSE: See the file COPYING.modifiedLGPL.txt, included in the Lazarus LICENSE: See the file COPYING.modifiedLGPL.txt, included in the Lazarus
distribution, for details about the license. distribution, for details about the license.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
unit fpsTypes; unit fpsTypes;
@ -136,26 +136,26 @@ const
{@@ Explanatory name of sfWikiTableWikiMedia file format } {@@ Explanatory name of sfWikiTableWikiMedia file format }
STR_FILEFORMAT_WIKITABLE_WIKIMEDIA = 'WikiTable (WikiMedia)'; STR_FILEFORMAT_WIKITABLE_WIKIMEDIA = 'WikiTable (WikiMedia)';
{@@ Default binary **Excel** file extension (<= Excel 97) } {@@ Default binary _Excel_ file extension (<= Excel 97) }
STR_EXCEL_EXTENSION = '.xls'; STR_EXCEL_EXTENSION = '.xls';
{@@ Default xml **Excel** file extension (Excel XP, 2003) } {@@ Default xml _Excel_ file extension (Excel XP, 2003) }
STR_XML_EXCEL_EXTENSION = '.xml'; STR_XML_EXCEL_EXTENSION = '.xml';
{@@ Default xml **Excel** file extension (>= Excel 2007) } {@@ Default xml _Excel_ file extension (>= Excel 2007) }
STR_OOXML_EXCEL_EXTENSION = '.xlsx'; STR_OOXML_EXCEL_EXTENSION = '.xlsx';
{@@ Default **OpenDocument** spreadsheet file extension } {@@ Default _OpenDocument_ spreadsheet file extension }
STR_OPENDOCUMENT_CALC_EXTENSION = '.ods'; STR_OPENDOCUMENT_CALC_EXTENSION = '.ods';
{@@ Default extension of <b>comma-separated-values</b> file } {@@ Default extension of _comma-separated-values_ file }
STR_COMMA_SEPARATED_EXTENSION = '.csv'; STR_COMMA_SEPARATED_EXTENSION = '.csv';
{@@ Default extension for <b>HTML</b> files } {@@ Default extension for _HTML_ files }
STR_HTML_EXTENSION = '.html'; STR_HTML_EXTENSION = '.html';
{@@ Default extension of <b>wikitable files</b> in <b>pipes</b> format} {@@ Default extension of _wikitable files_ in _pipes_ format}
STR_WIKITABLE_PIPES_EXTENSION = '.wikitable_pipes'; STR_WIKITABLE_PIPES_EXTENSION = '.wikitable_pipes';
{@@ Default extension of <b>wikitable files</b> in <b>wikimedia</b> format } {@@ Default extension of _wikitable files_ in _wikimedia_ format }
STR_WIKITABLE_WIKIMEDIA_EXTENSION = '.wikitable_wikimedia'; STR_WIKITABLE_WIKIMEDIA_EXTENSION = '.wikitable_wikimedia';
{@@ String for boolean value TRUE } {@@ String for boolean value @TRUE }
STR_TRUE = 'TRUE'; STR_TRUE = 'TRUE';
{@@ String for boolean value FALSE } {@@ String for boolean value @FALSE }
STR_FALSE = 'FALSE'; STR_FALSE = 'FALSE';
{@@ Error values } {@@ Error values }

View File

@ -7,7 +7,7 @@
LICENSE: See the file COPYING.modifiedLGPL.txt, included in the Lazarus LICENSE: See the file COPYING.modifiedLGPL.txt, included in the Lazarus
distribution, for details about the license. distribution, for details about the license.
EXAMPLE EXAMPLE OF USAGE:
* Add a _WorkbookSource_ component to the form. * Add a _WorkbookSource_ component to the form.
* Add a _WorksheetTabControl_ * Add a _WorksheetTabControl_
* Add a _WorksheetGrid_ (from unit fpspreadsheetgrid) * Add a _WorksheetGrid_ (from unit fpspreadsheetgrid)
@ -723,7 +723,7 @@ var
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Returns TRUE if the clipboard contains a format good for pasting into a Returns @TRUE if the clipboard contains a format good for pasting into a
worksheet grid. worksheet grid.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function SpreadsheetFormatInClipboard: Boolean; function SpreadsheetFormatInClipboard: Boolean;
@ -737,6 +737,7 @@ begin
Clipboard.HasFormat(CF_TEXT); Clipboard.HasFormat(CF_TEXT);
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
{ TsCellList } { TsCellList }
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
@ -786,7 +787,8 @@ begin
end; end;
end; end;
{ Adds a "non-existing" cell to the list. Such a cell is nil in the worksheet. {@@
Adds a "non-existing" cell to the list. Such a cell is nil in the worksheet.
Here it has ContentType = cctEmpty and UsedFormattingFields = [], i.e. it is Here it has ContentType = cctEmpty and UsedFormattingFields = [], i.e. it is
an empty cell without formatting. } an empty cell without formatting. }
function TsCellList.AddEmptyCell(ARow, ACol: Cardinal): Integer; function TsCellList.AddEmptyCell(ARow, ACol: Cardinal): Integer;
@ -852,8 +854,7 @@ end;
Constructor of the WorkbookSource class. Creates the internal list for the Constructor of the WorkbookSource class. Creates the internal list for the
notified ("listening") components, and creates an empty workbook. notified ("listening") components, and creates an empty workbook.
@param AOwner Component which is responsibile for destroying the @param AOwner Component which is responsibile for destroying the WorkbookSource.
WorkbookSource.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
constructor TsWorkbookSource.Create(AOwner: TComponent); constructor TsWorkbookSource.Create(AOwner: TComponent);
begin begin
@ -896,8 +897,8 @@ end;
Adds a component to the listener list. All these components are notified of Adds a component to the listener list. All these components are notified of
changes in the workbook. changes in the workbook.
@param AListener Component to be added to the listener list notified of @param(AListener Component to be added to the listener list notified of
changes changes.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbookSource.AddListener(AListener: TComponent); procedure TsWorkbookSource.AddListener(AListener: TComponent);
begin begin
@ -1003,23 +1004,15 @@ begin
FWorksheet := FWorkbook.AddWorksheet(Format(rsDefaultSheetName,[1])); FWorksheet := FWorkbook.AddWorksheet(Format(rsDefaultSheetName,[1]));
SelectWorksheet(FWorksheet); SelectWorksheet(FWorksheet);
end; end;
(*
{@@ ----------------------------------------------------------------------------
Disables notification of listening controls
-------------------------------------------------------------------------------}
procedure TsWorkbookSource.DisableControls;
begin
inc(FControlLockCount);
end; *)
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
An error has occured during loading of the workbook. Shows a message box by An error has occured during loading of the workbook. Shows a message box by
default. But a different behavior can be obtained by means of the OnError default. But a different behavior can be obtained by means of the OnError
event. event.
@param AErrorMsg Error message text created by the workbook reader and to be @param(AErrorMsg Error message text created by the workbook reader and to be
displayed in a messagebox or by means of the OnError displayed in a messagebox or by means of the OnError
handler. handler.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbookSource.DoShowError(const AErrorMsg: String); procedure TsWorkbookSource.DoShowError(const AErrorMsg: String);
begin begin
@ -1028,14 +1021,6 @@ begin
else else
MessageDlg(AErrorMsg, mtError, [mbOK], 0); MessageDlg(AErrorMsg, mtError, [mbOK], 0);
end; end;
(*
{@@ ----------------------------------------------------------------------------
Enables notification of listening controls
-------------------------------------------------------------------------------}
procedure TsWorkbookSource.EnableControls;
begin
dec(FControlLockCount);
end; *)
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Executes a "pending operation" Executes a "pending operation"
@ -1131,16 +1116,16 @@ end;
Internal loader for the spreadsheet file. Is called with various combinations Internal loader for the spreadsheet file. Is called with various combinations
of arguments from several procedures. of arguments from several procedures.
@param AFilename Name of the spreadsheet file to be loaded @param(AFilename Name of the spreadsheet file to be loaded.)
@param AAutoDetect Instructs the loader to automatically detect the @param(AAutoDetect Instructs the loader to automatically detect the
file format from the file extension or by temporarily file format from the file extension or by temporarily
opening the file in all available formats. Note that opening the file in all available formats. Note that
an exception is raised in the IDE when an incorrect an exception is raised in the IDE when an incorrect
format is tested. format is tested.)
@param AFormatID Identifier of the spreadsheet file format assumed @param(AFormatID Identifier of the spreadsheet file format assumed
for the loader. for the loader.
Is ignored when AAutoDetect is false. Is ignored when AAutoDetect is @false.)
@param AWorksheetIndex Index of the worksheet to be selected after loading. @param(AWorksheetIndex Index of the worksheet to be selected after loading.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbookSource.InternalLoadFromFile(AFileName: string; procedure TsWorkbookSource.InternalLoadFromFile(AFileName: string;
AAutoDetect: Boolean; AFormatID: TsSpreadFormatID; AAutoDetect: Boolean; AFormatID: TsSpreadFormatID;
@ -1192,6 +1177,7 @@ end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Inherited method which is called after reading the WorkbookSource from the lfm Inherited method which is called after reading the WorkbookSource from the lfm
file. file.
Is overridden here to open a spreadsheet file if a file name has been assigned Is overridden here to open a spreadsheet file if a file name has been assigned
to the FileName property at design-time. to the FileName property at design-time.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
@ -1209,10 +1195,10 @@ end;
Call this method only for built-in file formats. Call this method only for built-in file formats.
@param AFilename Name of the spreadsheet file to be loaded @param(AFilename Name of the spreadsheet file to be loaded.)
@param AFormat Spreadsheet file format assumed for the file @param(AFormat Spreadsheet file format assumed for the file.)
@param AWorksheetIndex Index of the worksheet to be selected after loading. @param(AWorksheetIndex Index of the worksheet to be selected after loading.
(If empty then the active worksheet is loaded) (If empty then the active worksheet is loaded) )
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbookSource.LoadFromSpreadsheetFile(AFileName: string; procedure TsWorkbookSource.LoadFromSpreadsheetFile(AFileName: string;
AFormat: TsSpreadsheetFormat; AWorksheetIndex: Integer = -1); AFormat: TsSpreadsheetFormat; AWorksheetIndex: Integer = -1);
@ -1227,11 +1213,11 @@ end;
Call this methdd for both built-in and user-provided file formats. Call this methdd for both built-in and user-provided file formats.
@param AFilename Name of the spreadsheet file to be loaded @param(AFilename Name of the spreadsheet file to be loaded.)
@param AFormatID Identifier of the spreadsheet file format assumed @param(AFormatID Identifier of the spreadsheet file format assumed
for the file for the file.)
@param AWorksheetIndex Index of the worksheet to be selected after loading. @param(AWorksheetIndex Index of the worksheet to be selected after loading.
(If empty then the active worksheet is loaded) (If empty then the active worksheet is loaded) )
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbookSource.LoadFromSpreadsheetFile(AFileName: string; procedure TsWorkbookSource.LoadFromSpreadsheetFile(AFileName: string;
AFormatID: TsSpreadFormatID = sfidUnknown; AWorksheetIndex: Integer = -1); AFormatID: TsSpreadFormatID = sfidUnknown; AWorksheetIndex: Integer = -1);
@ -1279,12 +1265,12 @@ end;
Notifies listeners of workbook, worksheet, cell, or selection changes. Notifies listeners of workbook, worksheet, cell, or selection changes.
The changed item is identified by the parameter AChangedItems. The changed item is identified by the parameter AChangedItems.
@param AChangedItems A set of elements lniWorkbook, lniWorksheet, @param(AChangedItems A set of elements lniWorkbook, lniWorksheet,
lniCell, lniSelection which indicate which item has lniCell, lniSelection which indicate which item has
changed. changed.)
@param AData Additional information on the change. Is used only for @param(AData Additional information on the change. Is used only for
lniCell and points to the cell having a changed value lniCell and points to the cell having a changed value
or formatting. or formatting.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbookSource.NotifyListeners(AChangedItems: TsNotificationItems; procedure TsWorkbookSource.NotifyListeners(AChangedItems: TsNotificationItems;
AData: Pointer = nil); AData: Pointer = nil);
@ -1333,13 +1319,13 @@ end;
Call this method only for built-in file formats. Call this method only for built-in file formats.
@param AFileName Name of the file to which the workbook is to be @param(AFileName Name of the file to which the workbook is to be
saved. saved.)
@param AFormat Spreadsheet file format in which the file is to be @param(AFormat Spreadsheet file format in which the file is to be
saved. saved.)
@param AOverwriteExisting If the file already exists, it is overwritten in @param(AOverwriteExisting If the file already exists, it is overwritten in
the case of AOverwriteExisting = true, or an the case of AOverwriteExisting = @true, or an
exception is raised otherwise. exception is raised otherwise.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbookSource.SaveToSpreadsheetFile(AFileName: String; procedure TsWorkbookSource.SaveToSpreadsheetFile(AFileName: String;
AFormat: TsSpreadsheetFormat; AOverwriteExisting: Boolean = true); AFormat: TsSpreadsheetFormat; AOverwriteExisting: Boolean = true);
@ -1354,13 +1340,13 @@ end;
Call this method for both built-in and user-provided file formats. Call this method for both built-in and user-provided file formats.
@param AFileName Name of the file to which the workbook is to be @param(AFileName Name of the file to which the workbook is to be
saved. saved.)
@param AFormatID Identifier of the spreadsheet file format in which @param(AFormatID Identifier of the spreadsheet file format in which
the file is to be saved. the file is to be saved.)
@param AOverwriteExisting If the file already exists, it is overwritten in @param(AOverwriteExisting If the file already exists, it is overwritten in
the case of AOverwriteExisting = true, or an the case of AOverwriteExisting = @true, or an
exception is raised otherwise. exception is raised otherwise.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbookSource.SaveToSpreadsheetFile(AFileName: String; procedure TsWorkbookSource.SaveToSpreadsheetFile(AFileName: String;
AFormatID: TsSpreadFormatID; AOverwriteExisting: Boolean = true); AFormatID: TsSpreadFormatID; AOverwriteExisting: Boolean = true);
@ -1382,13 +1368,13 @@ end;
If this file name already exists the file is overwritten If this file name already exists the file is overwritten
if AOverwriteExisting is true. if AOverwriteExisting is true.
@param AFileName Name of the file to which the workbook is to be @param(AFileName Name of the file to which the workbook is to be
saved saved.
If the file format is not known is is written If the file format is not known is is written
as BIFF8/XLS. as BIFF8/XLS. )
@param AOverwriteExisting If this file already exists it is overwritten if @param(AOverwriteExisting If this file already exists it is overwritten if
AOverwriteExisting = true, or an exception is AOverwriteExisting = @true, or an exception is
raised if AOverwriteExisting = false. raised if AOverwriteExisting = @false.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbookSource.SaveToSpreadsheetFile(AFileName: String; procedure TsWorkbookSource.SaveToSpreadsheetFile(AFileName: String;
AOverwriteExisting: Boolean = true); AOverwriteExisting: Boolean = true);
@ -1626,7 +1612,7 @@ end;
AOperation determines which "item" of the cell (all, values, formats, formula) AOperation determines which "item" of the cell (all, values, formats, formula)
is pasted. is pasted.
If ATranspose is TRUE then rows and columns are interchanged. If ATranspose is @TRUE then rows and columns are interchanged.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbookSource.PasteCellsFromClipboard(AItem: TsCopyOperation; procedure TsWorkbookSource.PasteCellsFromClipboard(AItem: TsCopyOperation;
ATransposed: Boolean = false); ATransposed: Boolean = false);
@ -1715,10 +1701,10 @@ end;
Event handler called AFTER a worksheet has been removed (deleted) from Event handler called AFTER a worksheet has been removed (deleted) from
the workbook the workbook
@param Sender Points to the workbook from which the sheet has been @param(Sender Points to the workbook from which the sheet has been
deleted deleted.)
@param ASheetIndex Index of the sheet that was deleted. The sheet itself @param(ASheetIndex Index of the sheet that was deleted. The sheet itself
does not exist any more. does not exist any more.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbookSource.WorksheetRemovedHandler(Sender: TObject; procedure TsWorkbookSource.WorksheetRemovedHandler(Sender: TObject;
ASheetIndex: Integer); ASheetIndex: Integer);
@ -1898,13 +1884,14 @@ end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Notification message received from the WorkbookSource telling which Notification message received from the WorkbookSource telling which
spreadsheet item has changed. spreadsheet item has changed.
Responds to workbook changes by reading the worksheet names into the tabs, Responds to workbook changes by reading the worksheet names into the tabs,
and to worksheet changes by selecting the tab corresponding to the selected and to worksheet changes by selecting the tab corresponding to the selected
worksheet. worksheet.
@param AChangedItems Set with elements identifying whether workbook, worksheet @param(AChangedItems Set with elements identifying whether workbook,
cell content or cell formatting has changed worksheet cell content or cell formatting has changed.)
@param AData Additional data, not used here @param(AData Additional data, not used here.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbookTabControl.ListenerNotification( procedure TsWorkbookTabControl.ListenerNotification(
AChangedItems: TsNotificationItems; AData: Pointer = nil); AChangedItems: TsNotificationItems; AData: Pointer = nil);
@ -2388,10 +2375,10 @@ end;
of the spreadsheet has changed. of the spreadsheet has changed.
Responds to selection and cell changes by updating the cell content. Responds to selection and cell changes by updating the cell content.
@param AChangedItems Set with elements identifying whether workbook, worksheet @param(AChangedItems Set with elements identifying whether workbook, worksheet
cell content or cell formatting has changed cell content or cell formatting has changed.)
@param AData If AChangedItems contains nliCell then AData points to @param(AData If AChangedItems contains nliCell then AData points to
the modified cell. the modified cell.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCellEdit.ListenerNotification( procedure TsCellEdit.ListenerNotification(
AChangedItems: TsNotificationItems; AData: Pointer = nil); AChangedItems: TsNotificationItems; AData: Pointer = nil);
@ -2527,8 +2514,8 @@ end;
It is assumed that the formula is localized. It is assumed that the formula is localized.
Returns TRUE if the provided string is a valid formula or no formula, FALSE @Returns(@TRUE if the provided string is a valid formula or no formula, @FALSE
otherwise. In the latter case an error message string is returned as well. otherwise. In the latter case an error message string is returned as well.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCellEdit.ValidFormula(AFormula: String; out AErrMsg: String): Boolean; function TsCellEdit.ValidFormula(AFormula: String; out AErrMsg: String): Boolean;
var var
@ -2564,7 +2551,8 @@ end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Writes the current edit text to the cell Writes the current edit text to the cell
Note: All validation checks already have been performed.
@Note All validation checks already have been performed.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCellEdit.WriteToCell; procedure TsCellEdit.WriteToCell;
var var
@ -2648,11 +2636,11 @@ end;
The cell indicator reacts to notification that the selection has changed The cell indicator reacts to notification that the selection has changed
and displays the address of the newly selected cell as editable text. and displays the address of the newly selected cell as editable text.
@param AChangedItems Set with elements identifying whether workbook, worksheet @param(AChangedItems Set with elements identifying whether workbook, worksheet
cell or selection has changed. Only the latter element cell or selection has changed. Only the latter element
is considered by the cell indicator. is considered by the cell indicator.)
@param AData If AChangedItems contains nliCell then AData points to @param(AData If AChangedItems contains nliCell then AData points to
the modified cell. the modified cell.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCellIndicator.ListenerNotification(AChangedItems: TsNotificationItems; procedure TsCellIndicator.ListenerNotification(AChangedItems: TsNotificationItems;
AData: Pointer = nil); AData: Pointer = nil);
@ -3300,10 +3288,10 @@ end;
Notification procedure received whenver "something" changes in the workbook. Notification procedure received whenver "something" changes in the workbook.
Reacts on all events. Reacts on all events.
@param AChangedItems Set with elements identifying whether workbook, worksheet @param(AChangedItems Set with elements identifying whether workbook, worksheet
cell or selection has changed. cell or selection has changed.)
@param AData If AChangedItems contains nliCell then AData points to @param(AData If AChangedItems contains nliCell then AData points to
the modified cell. the modified cell.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCellCombobox.ListenerNotification( procedure TsCellCombobox.ListenerNotification(
AChangedItems: TsNotificationItems; AData: Pointer = nil); AChangedItems: TsNotificationItems; AData: Pointer = nil);
@ -3408,6 +3396,7 @@ end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Processes the selected combobox item after a new item has been selected or the Processes the selected combobox item after a new item has been selected or the
item text has been edited. item text has been edited.
Changes the selected cells according to the Mode property by calling Changes the selected cells according to the Mode property by calling
ApplyFormatToCell. ApplyFormatToCell.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
@ -3681,10 +3670,10 @@ end;
Notification procedure received whenver "something" changes in the workbook. Notification procedure received whenver "something" changes in the workbook.
Reacts on all events. Reacts on all events.
@param AChangedItems Set with elements identifying whether workbook, worksheet @param(AChangedItems Set with elements identifying whether workbook, worksheet
cell or selection has changed. cell or selection has changed.)
@param AData If AChangedItems contains nliCell then AData points to @param(AData If AChangedItems contains nliCell then AData points to
the modified cell. the modified cell.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsSpreadsheetInspector.ListenerNotification( procedure TsSpreadsheetInspector.ListenerNotification(
AChangedItems: TsNotificationItems; AData: Pointer = nil); AChangedItems: TsNotificationItems; AData: Pointer = nil);

View File

@ -1,5 +1,5 @@
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Unit fpspreadsheet implements a <b>grid</b> component which can load and Unit fpspreadsheet implements a **grid** component which can load and
write data from/to FPSpreadsheet documents. write data from/to FPSpreadsheet documents.
Can either be used alone or in combination with a TsWorkbookSource component. Can either be used alone or in combination with a TsWorkbookSource component.
@ -336,8 +336,7 @@ type
procedure TopLeftChanged; override; procedure TopLeftChanged; override;
function TrimToCell(ACell: PCell): String; function TrimToCell(ACell: PCell): String;
procedure ValidateInput(var Msg: TLMessage); message UM_VALIDATEINPUT; procedure ValidateInput(var Msg: TLMessage); message UM_VALIDATEINPUT;
function ValidFormula({ACol, ARow: Integer; }AExpression: String; function ValidFormula(AExpression: String; out AErrMsg: String): Boolean;
out AErrMsg: String): Boolean;
procedure WMHScroll(var message: TLMHScroll); message LM_HSCROLL; procedure WMHScroll(var message: TLMHScroll); message LM_HSCROLL;
procedure WMVScroll(var message: TLMVScroll); message LM_VSCROLL; procedure WMVScroll(var message: TLMVScroll); message LM_VSCROLL;
@ -922,6 +921,7 @@ var
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Helper procedure which creates bitmaps used for fill patterns in cell Helper procedure which creates bitmaps used for fill patterns in cell
backgrounds. backgrounds.
The parameters are buffered in FillPatternXXXX variables to avoid unnecessary The parameters are buffered in FillPatternXXXX variables to avoid unnecessary
creation of the same bitmaps again and again. creation of the same bitmaps again and again.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
@ -1119,7 +1119,7 @@ end; *)
@param c Color to be modified @param c Color to be modified
@param ADelta Value to be added to the RGB components of the inpur color @param ADelta Value to be added to the RGB components of the inpur color
@result Modified color. @returns Modified color.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function CalcSelectionColor(c: TColor; ADelta: Byte) : TColor; function CalcSelectionColor(c: TColor; ADelta: Byte) : TColor;
type type
@ -1529,6 +1529,7 @@ end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
The BeginUpdate/EndUpdate pair suppresses unnecessary painting of the grid. The BeginUpdate/EndUpdate pair suppresses unnecessary painting of the grid.
Call BeginUpdate to stop refreshing the grid, and call EndUpdate to release Call BeginUpdate to stop refreshing the grid, and call EndUpdate to release
the lock and to repaint the grid again. the lock and to repaint the grid again.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
@ -1581,8 +1582,8 @@ end;
Converts the row height (from a worksheet row record), given in units used by Converts the row height (from a worksheet row record), given in units used by
the sheet, to pixels as needed by the grid the sheet, to pixels as needed by the grid
@param AHeight Row height expressed in units used by the worksheet. @param AHeight Row height expressed in units used by the worksheet.
@result Row height in pixels. @returns Row height in pixels.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.CalcRowHeightFromSheet(AHeight: Single): Integer; function TsCustomWorksheetGrid.CalcRowHeightFromSheet(AHeight: Single): Integer;
var var
@ -1638,8 +1639,8 @@ end;
Converts the column height given in screen pixels to the units used by the Converts the column height given in screen pixels to the units used by the
worksheet. worksheet.
@param AValue Column width in pixels @param AValue Column width in pixels
@result Column width expressed in units defined by the workbook. @returns Column width expressed in units defined by the workbook.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.CalcWorksheetColWidth(AValue: Integer): Single; function TsCustomWorksheetGrid.CalcWorksheetColWidth(AValue: Integer): Single;
var var
@ -1659,8 +1660,8 @@ end;
Converts the row height given in screen pixels to the units used by the Converts the row height given in screen pixels to the units used by the
worksheet. worksheet.
@param AValue Row height in pixels @param AValue Row height in pixels
@result Row height expressed in units defined by the workbook. @returns Row height expressed in units defined by the workbook.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.CalcWorksheetRowHeight(AValue: Integer): Single; function TsCustomWorksheetGrid.CalcWorksheetRowHeight(AValue: Integer): Single;
var var
@ -1685,18 +1686,15 @@ end;
Looks for overflowing cells: if the text of the given cell is longer than Looks for overflowing cells: if the text of the given cell is longer than
the cell width the function calculates the column indexes and the rectangle the cell width the function calculates the column indexes and the rectangle
to show the complete text. to show the complete text.
Ony for non-wordwrapped label cells and for horizontal orientation. Ony for non-wordwrapped label cells and for horizontal orientation.
Function returns false if text overflow needs not to be considered. Function returns false if text overflow needs not to be considered.
@param ACol, ARow Column and row indexes (in grid coordinates) of the cell @param ACol,ARow Column and row indexes (in grid coordinates) of the cell to be drawn
to be drawn
@param AState GridDrawState of the cell (normal, fixed, selected etc) @param AState GridDrawState of the cell (normal, fixed, selected etc)
@param ACol1,ACol2 (output) Index of the first and last column covered by the @param ACol1,ACol2 (output) Index of the first and last column covered by the overflowing text
overflowing text @param ARect (output) Pixel rectangle enclosing the cell and its neighbors affected
@param ARect (output) Pixel rectangle enclosing the cell and its neighbors @returns @TRUE if text overflow into neighbor cells is to be considered, @FALSE if not.
affected
@return TRUE if text overflow into neighbor cells is to be considered,
FALSE if not.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.CellOverflow(ACol, ARow: Integer; function TsCustomWorksheetGrid.CellOverflow(ACol, ARow: Integer;
AState: TGridDrawState; out ACol1, ACol2: Integer; var ARect: TRect): Boolean; AState: TGridDrawState; out ACol1, ACol2: Integer; var ARect: TRect): Boolean;
@ -2484,10 +2482,12 @@ end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Draws the borders of all cells. Calls DrawCellBorders for each individual cell. Draws the borders of all cells. Calls DrawCellBorders for each individual cell.
AGridPart denotes where the cells are painted: AGridPart denotes where the cells are painted:
0 = normal grid area @unorderedlist(
1 = FrozenRows @item(0 = normal grid area)
2 = FrozenCols @item(1 = FrozenRows)
3 = Top-left corner where FrozenCols and FrozenRows intersect @item(2 = FrozenCols)
@item(3 = Top-left corner where FrozenCols and FrozenRows intersect)
)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.DrawCellBorders(AGridPart: Integer = 0); procedure TsCustomWorksheetGrid.DrawCellBorders(AGridPart: Integer = 0);
var var
@ -2777,10 +2777,9 @@ end;
@param AStart Start coordinate of the pane border line @param AStart Start coordinate of the pane border line
@param AEnd End coordinate of the pane border line @param AEnd End coordinate of the pane border line
@param ACoord other coordinate of the border line @param ACoord Other coordinate of the border line (y if horizontal, x if vertical)
(y if horizontal, x if vertical) @param(IsHor Determines whether a horizontal or vertical line is drawn and,
@param IsHor Determines whether a horizontal or vertical line is drawn and, thus, how AStart, AEnd and ACoord are interpreted.)
thus, how AStart, AEnd and ACoord are interpreted.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.DrawFrozenPaneBorder(AStart, AEnd, ACoord: Integer; procedure TsCustomWorksheetGrid.DrawFrozenPaneBorder(AStart, AEnd, ACoord: Integer;
IsHor: Boolean); IsHor: Boolean);
@ -3499,9 +3498,9 @@ end;
Returns the background color of a cell. The color is given as an index into Returns the background color of a cell. The color is given as an index into
the workbook's color palette. the workbook's color palette.
@param ACol Grid column index of the cell @param ACol Grid column index of the cell
@param ARow Grid row index of the cell @param ARow Grid row index of the cell
@result Color index of the cell's background color. @returns Color index of the cell's background color.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.GetBackgroundColor(ACol, ARow: Integer): TsColor; function TsCustomWorksheetGrid.GetBackgroundColor(ACol, ARow: Integer): TsColor;
var var
@ -3524,8 +3523,8 @@ end;
@param ATop Index of the top row of the cell range @param ATop Index of the top row of the cell range
@param ARight Index of the right column of the cell range @param ARight Index of the right column of the cell range
@param ABottom Index of the bottom row of the cell range @param ABottom Index of the bottom row of the cell range
@return Color index common to all cells within the selection. If the cells' @return(Color index common to all cells within the selection. If the cells'
background colors are different the value scUndefined is returned. background colors are different the value scUndefined is returned.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.GetBackgroundColors(ALeft, ATop, ARight, ABottom: Integer): TsColor; function TsCustomWorksheetGrid.GetBackgroundColors(ALeft, ATop, ARight, ABottom: Integer): TsColor;
var var
@ -3607,9 +3606,9 @@ end;
@param ATop Index of the top row of the cell range @param ATop Index of the top row of the cell range
@param ARight Index of the right column of the cell range @param ARight Index of the right column of the cell range
@param ABottom Index of the bottom row of the cell range @param ABottom Index of the bottom row of the cell range
@return Set with flags indicating where borders are drawn (top/left/right/bottom) @return(Set with flags indicating where borders are drawn (top/left/right/bottom)
If the individual cells within the range have different borders an If the individual cells within the range have different borders an
empty set is returned. empty set is returned.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.GetCellBorders(ALeft, ATop, ARight, ABottom: Integer): TsCellBorders; function TsCustomWorksheetGrid.GetCellBorders(ALeft, ATop, ARight, ABottom: Integer): TsCellBorders;
var var
@ -3642,10 +3641,8 @@ end;
@param ACol Grid column index of the cell @param ACol Grid column index of the cell
@param ARow Grid row index of the cell @param ARow Grid row index of the cell
@param ABorder Identifier of the border at which the line will be drawn @param ABorder Identifier of the border at which the line will be drawn (see TsCellBorder)
(see TsCellBorder) @return CellBorderStyle record containing information on line style and line color.
@return CellBorderStyle record containing information on line style and
line color.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.GetCellBorderStyle(ACol, ARow: Integer; function TsCustomWorksheetGrid.GetCellBorderStyle(ACol, ARow: Integer;
ABorder: TsCellBorder): TsCellBorderStyle; ABorder: TsCellBorder): TsCellBorderStyle;
@ -3671,10 +3668,8 @@ end;
@param ATop Index of the top row of the cell range @param ATop Index of the top row of the cell range
@param ARight Index of the right column of the cell range @param ARight Index of the right column of the cell range
@param ABottom Index of the bottom row of the cell range @param ABottom Index of the bottom row of the cell range
@param ABorder Identifier of the border where the line will be drawn @param ABorder Identifier of the border where the line will be drawn (see TsCellBorder)
(see TsCellBorder) @return CellBorderStyle record containing information on line style and line color.
@return CellBorderStyle record containing information on line style and
line color.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.GetCellBorderStyles(ALeft, ATop, ARight, ABottom: Integer; function TsCustomWorksheetGrid.GetCellBorderStyles(ALeft, ATop, ARight, ABottom: Integer;
ABorder: TsCellBorder): TsCellBorderStyle; ABorder: TsCellBorder): TsCellBorderStyle;
@ -3780,10 +3775,10 @@ end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Returns the height (in pixels) of the cell at ACol/ARow (of the grid). Returns the height (in pixels) of the cell at ACol/ARow (of the grid).
@param ACol Grid column index of the cell @param(ACol Grid column index of the cell.)
@param ARow Grid row index of the cell @param(ARow Grid row index of the cell.)
@result Height of the cell in pixels. Wrapped text is handled correctly. @return(Height of the cell in pixels. Wrapped text is handled correctly.
Value contains the zoom factor. Value contains the zoom factor.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.GetCellHeight(ACol, ARow: Integer): Integer; function TsCustomWorksheetGrid.GetCellHeight(ACol, ARow: Integer): Integer;
var var
@ -3862,6 +3857,7 @@ end;
This function defines the text to be displayed as a cell hint. By default, it This function defines the text to be displayed as a cell hint. By default, it
is the comment and/or the hyperlink attached to a cell; it can further be is the comment and/or the hyperlink attached to a cell; it can further be
modified by using the OnGetCellHint event. modified by using the OnGetCellHint event.
Option goCellHints must be active for the cell hint feature to work. Option goCellHints must be active for the cell hint feature to work.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.GetCellHintText(ACol, ARow: Integer): String; function TsCustomWorksheetGrid.GetCellHintText(ACol, ARow: Integer): String;
@ -3933,8 +3929,7 @@ end;
@param ACol Grid column index of the cell @param ACol Grid column index of the cell
@param ARow Grid row index of the cell @param ARow Grid row index of the cell
@param ATrim If true show replacement characters if numerical data @param ATrim If true show replacement characters if numerical data are wider than cell.
are wider than cell.
@return Text to be displayed in the cell. @return Text to be displayed in the cell.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.GetCellText(ACol, ARow: Integer; function TsCustomWorksheetGrid.GetCellText(ACol, ARow: Integer;
@ -4044,7 +4039,8 @@ end;
Determines the style of the border between a cell and its neighbor given by Determines the style of the border between a cell and its neighbor given by
ADeltaCol and ADeltaRow (one of them must be 0, the other one can only be +/-1). ADeltaCol and ADeltaRow (one of them must be 0, the other one can only be +/-1).
ACol and ARow are in grid units. ACol and ARow are in grid units.
Result is FALSE if there is no border line.
@return Result is @FALSE if there is no border line.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.GetBorderStyle(ACol, ARow, ADeltaCol, ADeltaRow: Integer; function TsCustomWorksheetGrid.GetBorderStyle(ACol, ARow, ADeltaCol, ADeltaRow: Integer;
ACell: PCell; out ABorderStyle: TsCellBorderStyle): Boolean; ACell: PCell; out ABorderStyle: TsCellBorderStyle): Boolean;
@ -4158,8 +4154,7 @@ end;
Returns a list of worksheets contained in the file. Useful for assigning to Returns a list of worksheets contained in the file. Useful for assigning to
user controls like TabControl, Combobox etc. in order to select a sheet. user controls like TabControl, Combobox etc. in order to select a sheet.
@param ASheets List of strings containing the names of the worksheets of @param ASheets List of strings containing the names of the worksheets of the workbook
the workbook
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.GetSheets(const ASheets: TStrings); procedure TsCustomWorksheetGrid.GetSheets(const ASheets: TStrings);
var var
@ -4174,7 +4169,7 @@ end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Calculates the index of the worksheet column that is displayed in the Calculates the index of the worksheet column that is displayed in the
given column of the grid. If the sheet headers are turned on, both numbers given column of the grid. If the sheet headers are turned on, both numbers
differ by 1, otherwise they are equal. Saves an "if" in cases. differ by 1, otherwise they are equal. Saves an "if" in some cases.
@param AGridCol Index of a grid column @param AGridCol Index of a grid column
@return Index of a the corresponding worksheet column @return Index of a the corresponding worksheet column
@ -4192,8 +4187,8 @@ end;
given row of the grid. If the sheet headers are turned on, both numbers given row of the grid. If the sheet headers are turned on, both numbers
differ by 1, otherwise they are equal. Saves an "if" in some cases. differ by 1, otherwise they are equal. Saves an "if" in some cases.
@param AGridRow Index of a grid row @param AGridRow Index of a grid row
@resturn Index of the corresponding worksheet row. @return Index of the corresponding worksheet row.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.GetWorksheetRow(AGridRow: Integer): Cardinal; function TsCustomWorksheetGrid.GetWorksheetRow(AGridRow: Integer): Cardinal;
begin begin
@ -4275,9 +4270,9 @@ end;
Inherited from TCustomGrid. Is called when column widths or row heights Inherited from TCustomGrid. Is called when column widths or row heights
have changed. Stores the new column width or row height in the worksheet. have changed. Stores the new column width or row height in the worksheet.
@param IsColumn Specifies whether the changed parameter is a column width @param(IsColumn Specifies whether the changed parameter is a column width
(true) or a row height (false) (@true) or a row height (@false))
@param Index Index of the changed column or row @param(Index Index of the changed column or row)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.HeaderSized(IsColumn: Boolean; AIndex: Integer); procedure TsCustomWorksheetGrid.HeaderSized(IsColumn: Boolean; AIndex: Integer);
const const
@ -4614,28 +4609,27 @@ end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Internal general text drawing method. Internal general text drawing method.
@param AText Text to be drawn @param(AText Text to be drawn)
@param AMeasureText Text used for checking if the text fits into the @param(AMeasureText Text used for checking if the text fits into the text
text rectangle. If too large and ReplaceTooLong = true, rectangle. If too large and ReplaceTooLong = @true,
a series of # is drawn. a series of # characters is drawn.)
@param ARect Rectangle in which the text is drawn @param(ARect Rectangle in which the text is drawn.)
@param AJustification Determines whether the text is drawn at the "start" (0), @param(AJustification Determines whether the text is drawn at the "start" (0),
"center" (1) or "end" (2) of the drawing rectangle. "center" (1) or "end" (2) of the drawing rectangle.
Start/center/end are seen along the text drawing Start/center/end are seen along the text drawing direction.)
direction. @param(ACellHorAlign Is the HorAlignment property stored in the cell.)
@param ACellHorAlign Is the HorAlignment property stored in the cell @param(ACellVertAlign Is the VertAlignment property stored in the cell.)
@param ACellVertAlign Is the VertAlignment property stored in the cell @param(ATextRot Determines the rotation angle of the text.)
@param ATextRot Determines the rotation angle of the text. @param(ATextWrap Determines if the text can wrap into multiple lines.)
@param ATextWrap Determines if the text can wrap into multiple lines @param(AFontIndex Font index to be used for drawing non-rich-text.)
@param AFontIndex Font index to be used for drawing non-rich-text. @param(ARichTextParams An array of character and font index combinations
@param ARichTextParams an array of character and font index combinations for for rich-text formatting of text in cell)
rich-text formatting of text in cell @param(AIsRightToLeft If @true cell must be drawn in right-to-left mode.)
@param AIsRightToLeft if true cell must be drawn in right-to-left mode.
@Note The reason to separate AJustification from ACellHorAlign and ACelVertAlign is @Note(The reason to separate AJustification from ACellHorAlign and ACelVertAlign
the output of nfAccounting formatted numbers where the numbers are always is the output of nfAccounting formatted numbers where the numbers are
right-aligned, and the currency symbol is left-aligned. always right-aligned, and the currency symbol is left-aligned.
THIS FEATURE IS CURRENTLY NO LONGER SUPPORTED. THIS FEATURE IS CURRENTLY NO LONGER SUPPORTED.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.InternalDrawTextInCell(AText: String; procedure TsCustomWorksheetGrid.InternalDrawTextInCell(AText: String;
ARect: TRect; ACellHorAlign: TsHorAlignment; ACellVertAlign: TsVertAlignment; ARect: TRect; ACellHorAlign: TsHorAlignment; ACellVertAlign: TsVertAlignment;
@ -4737,10 +4731,10 @@ end;
Call this method only for built-in file formats. Call this method only for built-in file formats.
@param AFileName Name of the file to be loaded @param(AFileName Name of the file to be loaded)
@param AFormat Spreadsheet file format assumed for the file @param(AFormat Spreadsheet file format assumed for the file)
@param AWorksheetIndex Index of the worksheet to be displayed in the grid @param(AWorksheetIndex Index of the worksheet to be displayed in the grid
(If empty then the active worksheet is loaded) (If empty then the active worksheet is loaded))
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.LoadFromSpreadsheetFile(AFileName: string; procedure TsCustomWorksheetGrid.LoadFromSpreadsheetFile(AFileName: string;
AFormat: TsSpreadsheetFormat; AWorksheetIndex: Integer); AFormat: TsSpreadsheetFormat; AWorksheetIndex: Integer);
@ -4759,11 +4753,11 @@ end;
Call this method for both built-in and user-provided file formats. Call this method for both built-in and user-provided file formats.
@param AFileName Name of the file to be loaded @param(AFileName Name of the file to be loaded)
@param AFormatID Spreadsheet file format identifier assumed for the @param(AFormatID Spreadsheet file format identifier assumed for the
file (automatic detection if empty) file (automatic detection if empty))
@param AWorksheetIndex Index of the worksheet to be displayed in the grid @param(AWorksheetIndex Index of the worksheet to be displayed in the grid
(If empty then the active worksheet is loaded) (If empty then the active worksheet is loaded))
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.LoadFromSpreadsheetFile(AFileName: string; procedure TsCustomWorksheetGrid.LoadFromSpreadsheetFile(AFileName: string;
AFormatID: TsSpreadFormatID = sfidUnknown; AWorksheetIndex: Integer = -1); AFormatID: TsSpreadFormatID = sfidUnknown; AWorksheetIndex: Integer = -1);
@ -4780,11 +4774,11 @@ end;
Creates a new workbook and loads the given file into it. Shows the sheet Creates a new workbook and loads the given file into it. Shows the sheet
with the specified sheet index. The file format is determined automatically. with the specified sheet index. The file format is determined automatically.
@param AFileName Name of the file to be loaded @param(AFileName Name of the file to be loaded)
@param AWorksheetIndex Index of the worksheet to be shown in the grid @param(AWorksheetIndex Index of the worksheet to be shown in the grid
(If empty then the active worksheet is loaded) (If empty then the active worksheet is loaded))
@param AFormatID Spreadsheet file format identifier assumed for the @param(AFormatID Spreadsheet file format identifier assumed for the
file (automatic detection if empty) file (automatic detection if empty))
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.LoadSheetFromSpreadsheetFile(AFileName: String; procedure TsCustomWorksheetGrid.LoadSheetFromSpreadsheetFile(AFileName: String;
AWorksheetIndex: Integer = -1; AFormatID: TsSpreadFormatID = sfidUnknown); AWorksheetIndex: Integer = -1; AFormatID: TsSpreadFormatID = sfidUnknown);
@ -4800,12 +4794,12 @@ end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Loads an existing workbook into the grid. Loads an existing workbook into the grid.
@param AWorkbook Workbook that had been created/loaded before. @param(AWorkbook Workbook that had been created/loaded before. )
@param AWorksheetIndex Index of the worksheet to be shown in the grid @param(AWorksheetIndex Index of the worksheet to be shown in the grid
(If empty then the active worksheet is loaded) (If empty then the active worksheet is loaded))
@Note THE CALLING PROCEDURE MUST NOT DESTROY THE WORKBOOK! The workbook will @Note(THE CALLING PROCEDURE MUST NOT DESTROY THE WORKBOOK!
be destroyed by the workbook source. The workbook will be destroyed by the workbook source.)
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.LoadFromWorkbook(AWorkbook: TsWorkbook; procedure TsCustomWorksheetGrid.LoadFromWorkbook(AWorkbook: TsWorkbook;
AWorksheetIndex: Integer = -1); AWorksheetIndex: Integer = -1);
@ -5303,13 +5297,11 @@ end;
Call this method only for built-in file formats. Call this method only for built-in file formats.
@param AFileName Name of the file to which the workbook is to be @param(AFileName Name of the file to which the workbook is to be saved.)
saved. @param(AFormat Spreadsheet file format in which the file is to be saved.)
@param AFormat Spreadsheet file format in which the file is to be @param(AOverwriteExisting If the file already exists, it is overwritten in the
saved. case of AOverwriteExisting = @true, or an exception
@param AOverwriteExisting If the file already exists, it is overwritten in is raised if AOverwriteExisting = @false)
the case of AOverwriteExisting = true, or an
exception is raised if AOverwriteExisting = false
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.SaveToSpreadsheetFile(AFileName: String; procedure TsCustomWorksheetGrid.SaveToSpreadsheetFile(AFileName: String;
AFormat: TsSpreadsheetFormat; AOverwriteExisting: Boolean = true); AFormat: TsSpreadsheetFormat; AOverwriteExisting: Boolean = true);
@ -5323,13 +5315,12 @@ end;
Call this method for both built-in and user-provided file formats. Call this method for both built-in and user-provided file formats.
@param AFileName Name of the file to which the workbook is to be @param(AFileName Name of the file to which the workbook is to be saved.)
saved. @param(AFormatID Identifier for the spreadsheet file format in which
@param AFormatID Identifier for the spreadsheet file format in the file is to be saved.)
which the file is to be saved. @param(AOverwriteExisting If the file already exists, it is overwritten in
@param AOverwriteExisting If the file already exists, it is overwritten in the case of AOverwriteExisting = @true, or an
the case of AOverwriteExisting = true, or an exception is raised if AOverwriteExisting = @false)
exception is raised if AOverwriteExisting = false
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.SaveToSpreadsheetFile(AFileName: String; procedure TsCustomWorksheetGrid.SaveToSpreadsheetFile(AFileName: String;
AFormatID: TsSpreadFormatID; AOverwriteExisting: Boolean = true); AFormatID: TsSpreadFormatID; AOverwriteExisting: Boolean = true);
@ -5342,13 +5333,11 @@ end;
Saves the workbook into a file with the specified file name. If this file Saves the workbook into a file with the specified file name. If this file
name already exists the file is overwritten if AOverwriteExisting is true. name already exists the file is overwritten if AOverwriteExisting is true.
@param AFileName Name of the file to which the workbook is to be @param(AFileName Name of the file to which the workbook is to be saved.
saved If the file format is not known it is written as BIFF8/XLS.)
If the file format is not known it is written @param(AOverwriteExisting If this file already exists it is overwritten if
as BIFF8/XLS. AOverwriteExisting = @true, or an exception is raised
@param AOverwriteExisting If this file already exists it is overwritten if if AOverwriteExisting = @false.)
AOverwriteExisting = true, or an exception is
raised if AOverwriteExisting = false.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.SaveToSpreadsheetFile(AFileName: String; procedure TsCustomWorksheetGrid.SaveToSpreadsheetFile(AFileName: String;
AOverwriteExisting: Boolean = true); AOverwriteExisting: Boolean = true);
@ -5644,13 +5633,13 @@ end;
Sort direction is determined by the property "SortOrder". Other sorting Sort direction is determined by the property "SortOrder". Other sorting
criteria are "case-sensitive" and "numbers first". criteria are "case-sensitive" and "numbers first".
@param AColSorting If true the grid is sorted from top to bottom and the @param(AColSorting If @true the grid is sorted from top to bottom and the
next parameter, "Index", refers to a column. Otherweise next parameter, "Index", refers to a column. Otherwise
sorting goes from left to right and "Index" refers to a row. sorting goes from left to right and "Index" refers to a row.)
@param AIndex Index of the column (if ColSorting=true) or row (ColSorting = false) @param(AIndex Index of the column (if ColSorting=@true) or row (ColSorting=@false)
which is sorted. which is sorted.)
@param AIndxFrom Sorting starts at this row (ColSorting=true) / column (ColSorting=false) @param(AIndxFrom Sorting starts at this row (ColSorting=@true) / column (ColSorting=@false))
@param AIndxTo Sorting ends at this row (ColSorting=true) / column (ColSorting=false) @param(AIndxTo Sorting ends at this row (ColSorting=@true) / column (ColSorting=@false))
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.Sort(AColSorting: Boolean; procedure TsCustomWorksheetGrid.Sort(AColSorting: Boolean;
AIndex, AIndxFrom, AIndxTo:Integer); AIndex, AIndxFrom, AIndxTo:Integer);
@ -5673,7 +5662,6 @@ begin
); );
end; end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Converts a coordinate given in workbook units to pixels using the current Converts a coordinate given in workbook units to pixels using the current
screen resolution screen resolution
@ -5687,7 +5675,8 @@ begin
end; end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Store the value of the TopLeft cell in the worksheet Is called whenever the worksheet is scrolled.
Stores the coordinates of the TopLeft cell in the worksheet
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.TopLeftChanged; procedure TsCustomWorksheetGrid.TopLeftChanged;
begin begin
@ -5696,7 +5685,7 @@ begin
end; end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Modifies the text that is show for cells which are too narrow to hold the Modifies the text that is shown for cells which are too narrow to hold the
entire text. The method follows the behavior of Excel and Open/LibreOffice: entire text. The method follows the behavior of Excel and Open/LibreOffice:
If the specified cell contains a non-formatted number, then it is formatted If the specified cell contains a non-formatted number, then it is formatted
such that the text fits into the cell. If the text is still too long or such that the text fits into the cell. If the text is still too long or
@ -5881,7 +5870,7 @@ end;
type is rhtAuto (meaning: "row height is auto-calculated") and the current type is rhtAuto (meaning: "row height is auto-calculated") and the current
row height in the row record is 0 then the row height is calculated by row height in the row record is 0 then the row height is calculated by
iterating over all cells in this row. This happens also if the parameter iterating over all cells in this row. This happens also if the parameter
AEnforceCalcRowHeight is true. AEnforceCalcRowHeight is @true.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.UpdateRowHeight(ARow: Integer; procedure TsCustomWorksheetGrid.UpdateRowHeight(ARow: Integer;
AEnforceCalcRowHeight: Boolean = false); AEnforceCalcRowHeight: Boolean = false);
@ -7005,7 +6994,7 @@ begin
InvalidateGrid; InvalidateGrid;
end; end;
{ Shows / hides formulas in the grid when AutoCalc is off } {@@ Shows/hides formulas in the grid when AutoCalc is off }
procedure TsCustomWorksheetGrid.SetShowFormulas(AValue: Boolean); procedure TsCustomWorksheetGrid.SetShowFormulas(AValue: Boolean);
begin begin
if AValue = FShowFormulas then if AValue = FShowFormulas then
@ -7014,7 +7003,7 @@ begin
InvalidateGrid; InvalidateGrid;
end; end;
{ Shows / hides the worksheet's grid lines } {@@ Shows/hides the worksheet's grid lines }
procedure TsCustomWorksheetGrid.SetShowGridLines(AValue: Boolean); procedure TsCustomWorksheetGrid.SetShowGridLines(AValue: Boolean);
begin begin
if AValue = GetShowGridLines then if AValue = GetShowGridLines then
@ -7032,7 +7021,7 @@ begin
Worksheet.Options := Worksheet.Options - [soShowGridLines]; Worksheet.Options := Worksheet.Options - [soShowGridLines];
end; end;
{ Shows / hides the worksheet's row and column headers. } {@@ Shows/hides the worksheet's row and column headers. }
procedure TsCustomWorksheetGrid.SetShowHeaders(AValue: Boolean); procedure TsCustomWorksheetGrid.SetShowHeaders(AValue: Boolean);
var var
hdrCount: Integer; hdrCount: Integer;
@ -7190,6 +7179,13 @@ begin
end; end;
end; end;
{@@ Checks whether the provided expression is a valid spreadsheet formula.
If not, a descriptive error message is returned in "AErrMsg", and the function
result becomes @false.
Decimal separator and date/time formats are expected to be localized.
In contrast to the Office applications, however, formula names are never
localized in fpspreadsheet. }
function TsCustomWorksheetGrid.ValidFormula(AExpression: String; function TsCustomWorksheetGrid.ValidFormula(AExpression: String;
out AErrMsg: String): Boolean; out AErrMsg: String): Boolean;
var var