diff --git a/components/fpspreadsheet/docs/api/builddoc.bat b/components/fpspreadsheet/docs/api/builddoc.bat index 97b3f34fd..7449616af 100644 --- a/components/fpspreadsheet/docs/api/builddoc.bat +++ b/components/fpspreadsheet/docs/api/builddoc.bat @@ -1,5 +1,3 @@ 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 -::%hhc_cmd% output\fpspreadsheet.hhc \ No newline at end of file + diff --git a/components/fpspreadsheet/docs/api/fpspreadsheet.css b/components/fpspreadsheet/docs/api/fpspreadsheet.css index e98fe2a12..2b68456af 100644 --- a/components/fpspreadsheet/docs/api/fpspreadsheet.css +++ b/components/fpspreadsheet/docs/api/fpspreadsheet.css @@ -148,9 +148,15 @@ td.itemunit {white-space:nowrap; } td.itemdesc { width:100%; } div.nodescription { color:red; } +dl.parameters dt { + font-family: monospace; + font-size:1.0em; +} +/* dl.parameters dt { color:blue; } +*/ code { font-family: monospace; diff --git a/components/fpspreadsheet/docs/api/make_chm.bat b/components/fpspreadsheet/docs/api/make_chm.bat new file mode 100644 index 000000000..88f5d62cb --- /dev/null +++ b/components/fpspreadsheet/docs/api/make_chm.bat @@ -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 + diff --git a/components/fpspreadsheet/docs/api/source-files.txt b/components/fpspreadsheet/docs/api/source-files.txt index 4f1008b67..8416dc737 100644 --- a/components/fpspreadsheet/docs/api/source-files.txt +++ b/components/fpspreadsheet/docs/api/source-files.txt @@ -5,3 +5,5 @@ ../../source/common/fpsnumformat.pas ../../source/common/fpsallformats.pas ../../source/common/fpsrpn.pas +../../source/visual/fpspreadsheetctrls.pas +../../source/visual/fpspreadsheetgrid.pas diff --git a/components/fpspreadsheet/docs/fpspreadsheet-api.chm b/components/fpspreadsheet/docs/fpspreadsheet-api.chm index fa984cbf3..ca72e67dc 100644 Binary files a/components/fpspreadsheet/docs/fpspreadsheet-api.chm and b/components/fpspreadsheet/docs/fpspreadsheet-api.chm differ diff --git a/components/fpspreadsheet/source/common/fpsopendocument.pas b/components/fpspreadsheet/source/common/fpsopendocument.pas index 0434f52c2..949a91fd3 100644 --- a/components/fpspreadsheet/source/common/fpsopendocument.pas +++ b/components/fpspreadsheet/source/common/fpsopendocument.pas @@ -13,7 +13,6 @@ mimetype - application/vnd.oasis.opendocument.spreadsheet META-INF\manifest.xml - Describes the other files in the archive Specifications obtained from: - http://docs.oasis-open.org/office/v1.1/OS/OpenDocument-v1.1.pdf AUTHORS: Felipe Monteiro de Carvalho / Jose Luis Jurado Rincon / Werner Pamler diff --git a/components/fpspreadsheet/source/common/fpsrpn.pas b/components/fpspreadsheet/source/common/fpsrpn.pas index 9a711a54f..4d4b6ca35 100644 --- a/components/fpspreadsheet/source/common/fpsrpn.pas +++ b/components/fpspreadsheet/source/common/fpsrpn.pas @@ -202,9 +202,8 @@ end; Excel-style address, e.g. A1:G5. As in Excel, use a $ sign to indicate absolute addresses. - @param ACellRangeAddress Adress of the cell range given in Excel notation, - such as A1:G5 - @param ANext Pointer to the next RPN item in the list + @param ACellRangeAddress Adress of the cell range given in Excel notation, such as A1:G5 + @param ANext Pointer to the next RPN item in the list -------------------------------------------------------------------------------} function RPNCellRange(ACellRangeAddress: String; ANext: PRPNItem): PRPNItem; var @@ -386,8 +385,9 @@ end; (--> TFEKind). Note that array elements for all needed parameters must have been created before. - @param AToken Formula element indicating the function to be executed, see the @link(TFEKind) enumeration for possible values. - @param ANext Pointer to the next RPN item in the list + @param(AToken Formula element indicating the function to be executed, see + the @link(TFEKind) enumeration for possible values.) + @param(ANext Pointer to the next RPN item in the list) @seeAlso TFEKind -------------------------------------------------------------------------------} @@ -449,9 +449,12 @@ end; 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 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. - + @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(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; var @@ -487,7 +490,9 @@ end; {@@ ---------------------------------------------------------------------------- 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); var diff --git a/components/fpspreadsheet/source/common/fpstypes.pas b/components/fpspreadsheet/source/common/fpstypes.pas index ed78134e4..f5fc3d2ed 100644 --- a/components/fpspreadsheet/source/common/fpstypes.pas +++ b/components/fpspreadsheet/source/common/fpstypes.pas @@ -6,7 +6,7 @@ AUTHORS: Werner Pamler 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; @@ -136,26 +136,26 @@ const {@@ Explanatory name of sfWikiTableWikiMedia file format } STR_FILEFORMAT_WIKITABLE_WIKIMEDIA = 'WikiTable (WikiMedia)'; - {@@ Default binary **Excel** file extension (<= Excel 97) } + {@@ Default binary _Excel_ file extension (<= Excel 97) } 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'; - {@@ Default xml **Excel** file extension (>= Excel 2007) } + {@@ Default xml _Excel_ file extension (>= Excel 2007) } STR_OOXML_EXCEL_EXTENSION = '.xlsx'; - {@@ Default **OpenDocument** spreadsheet file extension } + {@@ Default _OpenDocument_ spreadsheet file extension } STR_OPENDOCUMENT_CALC_EXTENSION = '.ods'; - {@@ Default extension of comma-separated-values file } + {@@ Default extension of _comma-separated-values_ file } STR_COMMA_SEPARATED_EXTENSION = '.csv'; - {@@ Default extension for HTML files } + {@@ Default extension for _HTML_ files } STR_HTML_EXTENSION = '.html'; - {@@ Default extension of wikitable files in pipes format} + {@@ Default extension of _wikitable files_ in _pipes_ format} STR_WIKITABLE_PIPES_EXTENSION = '.wikitable_pipes'; - {@@ Default extension of wikitable files in wikimedia format } + {@@ Default extension of _wikitable files_ in _wikimedia_ format } STR_WIKITABLE_WIKIMEDIA_EXTENSION = '.wikitable_wikimedia'; - {@@ String for boolean value TRUE } + {@@ String for boolean value @TRUE } STR_TRUE = 'TRUE'; - {@@ String for boolean value FALSE } + {@@ String for boolean value @FALSE } STR_FALSE = 'FALSE'; {@@ Error values } diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetctrls.pas b/components/fpspreadsheet/source/visual/fpspreadsheetctrls.pas index 56365d76a..a39a4c849 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetctrls.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetctrls.pas @@ -7,7 +7,7 @@ LICENSE: See the file COPYING.modifiedLGPL.txt, included in the Lazarus distribution, for details about the license. - EXAMPLE + EXAMPLE OF USAGE: * Add a _WorkbookSource_ component to the form. * Add a _WorksheetTabControl_ * 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. -------------------------------------------------------------------------------} function SpreadsheetFormatInClipboard: Boolean; @@ -737,6 +737,7 @@ begin Clipboard.HasFormat(CF_TEXT); end; + {------------------------------------------------------------------------------} { TsCellList } {------------------------------------------------------------------------------} @@ -786,7 +787,8 @@ begin 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 an empty cell without formatting. } function TsCellList.AddEmptyCell(ARow, ACol: Cardinal): Integer; @@ -852,8 +854,7 @@ end; Constructor of the WorkbookSource class. Creates the internal list for the notified ("listening") components, and creates an empty workbook. - @param AOwner Component which is responsibile for destroying the - WorkbookSource. + @param AOwner Component which is responsibile for destroying the WorkbookSource. -------------------------------------------------------------------------------} constructor TsWorkbookSource.Create(AOwner: TComponent); begin @@ -896,8 +897,8 @@ end; Adds a component to the listener list. All these components are notified of changes in the workbook. - @param AListener Component to be added to the listener list notified of - changes + @param(AListener Component to be added to the listener list notified of + changes.) -------------------------------------------------------------------------------} procedure TsWorkbookSource.AddListener(AListener: TComponent); begin @@ -1003,23 +1004,15 @@ begin FWorksheet := FWorkbook.AddWorksheet(Format(rsDefaultSheetName,[1])); SelectWorksheet(FWorksheet); 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 default. But a different behavior can be obtained by means of the OnError event. - @param AErrorMsg Error message text created by the workbook reader and to be - displayed in a messagebox or by means of the OnError - handler. + @param(AErrorMsg Error message text created by the workbook reader and to be + displayed in a messagebox or by means of the OnError + handler.) -------------------------------------------------------------------------------} procedure TsWorkbookSource.DoShowError(const AErrorMsg: String); begin @@ -1028,14 +1021,6 @@ begin else MessageDlg(AErrorMsg, mtError, [mbOK], 0); end; - (* -{@@ ---------------------------------------------------------------------------- - Enables notification of listening controls --------------------------------------------------------------------------------} -procedure TsWorkbookSource.EnableControls; -begin - dec(FControlLockCount); -end; *) {@@ ---------------------------------------------------------------------------- Executes a "pending operation" @@ -1131,16 +1116,16 @@ end; Internal loader for the spreadsheet file. Is called with various combinations of arguments from several procedures. - @param AFilename Name of the spreadsheet file to be loaded - @param AAutoDetect Instructs the loader to automatically detect the - file format from the file extension or by temporarily - opening the file in all available formats. Note that - an exception is raised in the IDE when an incorrect - format is tested. - @param AFormatID Identifier of the spreadsheet file format assumed - for the loader. - Is ignored when AAutoDetect is false. - @param AWorksheetIndex Index of the worksheet to be selected after loading. + @param(AFilename Name of the spreadsheet file to be loaded.) + @param(AAutoDetect Instructs the loader to automatically detect the + file format from the file extension or by temporarily + opening the file in all available formats. Note that + an exception is raised in the IDE when an incorrect + format is tested.) + @param(AFormatID Identifier of the spreadsheet file format assumed + for the loader. + Is ignored when AAutoDetect is @false.) + @param(AWorksheetIndex Index of the worksheet to be selected after loading.) -------------------------------------------------------------------------------} procedure TsWorkbookSource.InternalLoadFromFile(AFileName: string; AAutoDetect: Boolean; AFormatID: TsSpreadFormatID; @@ -1192,6 +1177,7 @@ end; {@@ ---------------------------------------------------------------------------- Inherited method which is called after reading the WorkbookSource from the lfm file. + Is overridden here to open a spreadsheet file if a file name has been assigned to the FileName property at design-time. -------------------------------------------------------------------------------} @@ -1209,10 +1195,10 @@ end; Call this method only for built-in file formats. - @param AFilename Name of the spreadsheet file to be loaded - @param AFormat Spreadsheet file format assumed for the file - @param AWorksheetIndex Index of the worksheet to be selected after loading. - (If empty then the active worksheet is loaded) + @param(AFilename Name of the spreadsheet file to be loaded.) + @param(AFormat Spreadsheet file format assumed for the file.) + @param(AWorksheetIndex Index of the worksheet to be selected after loading. + (If empty then the active worksheet is loaded) ) -------------------------------------------------------------------------------} procedure TsWorkbookSource.LoadFromSpreadsheetFile(AFileName: string; AFormat: TsSpreadsheetFormat; AWorksheetIndex: Integer = -1); @@ -1227,11 +1213,11 @@ end; Call this methdd for both built-in and user-provided file formats. - @param AFilename Name of the spreadsheet file to be loaded - @param AFormatID Identifier of the spreadsheet file format assumed - for the file - @param AWorksheetIndex Index of the worksheet to be selected after loading. - (If empty then the active worksheet is loaded) + @param(AFilename Name of the spreadsheet file to be loaded.) + @param(AFormatID Identifier of the spreadsheet file format assumed + for the file.) + @param(AWorksheetIndex Index of the worksheet to be selected after loading. + (If empty then the active worksheet is loaded) ) -------------------------------------------------------------------------------} procedure TsWorkbookSource.LoadFromSpreadsheetFile(AFileName: string; AFormatID: TsSpreadFormatID = sfidUnknown; AWorksheetIndex: Integer = -1); @@ -1279,12 +1265,12 @@ end; Notifies listeners of workbook, worksheet, cell, or selection changes. The changed item is identified by the parameter AChangedItems. - @param AChangedItems A set of elements lniWorkbook, lniWorksheet, - lniCell, lniSelection which indicate which item has - changed. - @param AData Additional information on the change. Is used only for - lniCell and points to the cell having a changed value - or formatting. + @param(AChangedItems A set of elements lniWorkbook, lniWorksheet, + lniCell, lniSelection which indicate which item has + changed.) + @param(AData Additional information on the change. Is used only for + lniCell and points to the cell having a changed value + or formatting.) -------------------------------------------------------------------------------} procedure TsWorkbookSource.NotifyListeners(AChangedItems: TsNotificationItems; AData: Pointer = nil); @@ -1333,13 +1319,13 @@ end; Call this method only for built-in file formats. - @param AFileName Name of the file to which the workbook is to be - saved. - @param AFormat Spreadsheet file format in which the file is to be - saved. - @param AOverwriteExisting If the file already exists, it is overwritten in - the case of AOverwriteExisting = true, or an - exception is raised otherwise. + @param(AFileName Name of the file to which the workbook is to be + saved.) + @param(AFormat Spreadsheet file format in which the file is to be + saved.) + @param(AOverwriteExisting If the file already exists, it is overwritten in + the case of AOverwriteExisting = @true, or an + exception is raised otherwise.) -------------------------------------------------------------------------------} procedure TsWorkbookSource.SaveToSpreadsheetFile(AFileName: String; AFormat: TsSpreadsheetFormat; AOverwriteExisting: Boolean = true); @@ -1354,13 +1340,13 @@ end; 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 - saved. - @param AFormatID Identifier of the spreadsheet file format in which - the file is to be saved. - @param AOverwriteExisting If the file already exists, it is overwritten in - the case of AOverwriteExisting = true, or an - exception is raised otherwise. + @param(AFileName Name of the file to which the workbook is to be + saved.) + @param(AFormatID Identifier of the spreadsheet file format in which + the file is to be saved.) + @param(AOverwriteExisting If the file already exists, it is overwritten in + the case of AOverwriteExisting = @true, or an + exception is raised otherwise.) -------------------------------------------------------------------------------} procedure TsWorkbookSource.SaveToSpreadsheetFile(AFileName: String; AFormatID: TsSpreadFormatID; AOverwriteExisting: Boolean = true); @@ -1382,13 +1368,13 @@ end; If this file name already exists the file is overwritten if AOverwriteExisting is true. - @param AFileName Name of the file to which the workbook is to be - saved - If the file format is not known is is written - as BIFF8/XLS. - @param AOverwriteExisting If this file already exists it is overwritten if - AOverwriteExisting = true, or an exception is - raised if AOverwriteExisting = false. + @param(AFileName Name of the file to which the workbook is to be + saved. + If the file format is not known is is written + as BIFF8/XLS. ) + @param(AOverwriteExisting If this file already exists it is overwritten if + AOverwriteExisting = @true, or an exception is + raised if AOverwriteExisting = @false.) -------------------------------------------------------------------------------} procedure TsWorkbookSource.SaveToSpreadsheetFile(AFileName: String; AOverwriteExisting: Boolean = true); @@ -1626,7 +1612,7 @@ end; AOperation determines which "item" of the cell (all, values, formats, formula) 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; ATransposed: Boolean = false); @@ -1715,10 +1701,10 @@ end; Event handler called AFTER a worksheet has been removed (deleted) from the workbook - @param Sender Points to the workbook from which the sheet has been - deleted - @param ASheetIndex Index of the sheet that was deleted. The sheet itself - does not exist any more. + @param(Sender Points to the workbook from which the sheet has been + deleted.) + @param(ASheetIndex Index of the sheet that was deleted. The sheet itself + does not exist any more.) -------------------------------------------------------------------------------} procedure TsWorkbookSource.WorksheetRemovedHandler(Sender: TObject; ASheetIndex: Integer); @@ -1898,13 +1884,14 @@ end; {@@ ---------------------------------------------------------------------------- Notification message received from the WorkbookSource telling which spreadsheet item has changed. + Responds to workbook changes by reading the worksheet names into the tabs, and to worksheet changes by selecting the tab corresponding to the selected worksheet. - @param AChangedItems Set with elements identifying whether workbook, worksheet - cell content or cell formatting has changed - @param AData Additional data, not used here + @param(AChangedItems Set with elements identifying whether workbook, + worksheet cell content or cell formatting has changed.) + @param(AData Additional data, not used here.) -------------------------------------------------------------------------------} procedure TsWorkbookTabControl.ListenerNotification( AChangedItems: TsNotificationItems; AData: Pointer = nil); @@ -2388,10 +2375,10 @@ end; of the spreadsheet has changed. Responds to selection and cell changes by updating the cell content. - @param AChangedItems Set with elements identifying whether workbook, worksheet - cell content or cell formatting has changed - @param AData If AChangedItems contains nliCell then AData points to - the modified cell. + @param(AChangedItems Set with elements identifying whether workbook, worksheet + cell content or cell formatting has changed.) + @param(AData If AChangedItems contains nliCell then AData points to + the modified cell.) -------------------------------------------------------------------------------} procedure TsCellEdit.ListenerNotification( AChangedItems: TsNotificationItems; AData: Pointer = nil); @@ -2527,8 +2514,8 @@ end; It is assumed that the formula is localized. - 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. + @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.) -------------------------------------------------------------------------------} function TsCellEdit.ValidFormula(AFormula: String; out AErrMsg: String): Boolean; var @@ -2564,7 +2551,8 @@ end; {@@ ---------------------------------------------------------------------------- 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; var @@ -2648,11 +2636,11 @@ end; The cell indicator reacts to notification that the selection has changed and displays the address of the newly selected cell as editable text. - @param AChangedItems Set with elements identifying whether workbook, worksheet - cell or selection has changed. Only the latter element - is considered by the cell indicator. - @param AData If AChangedItems contains nliCell then AData points to - the modified cell. + @param(AChangedItems Set with elements identifying whether workbook, worksheet + cell or selection has changed. Only the latter element + is considered by the cell indicator.) + @param(AData If AChangedItems contains nliCell then AData points to + the modified cell.) -------------------------------------------------------------------------------} procedure TsCellIndicator.ListenerNotification(AChangedItems: TsNotificationItems; AData: Pointer = nil); @@ -3300,10 +3288,10 @@ end; Notification procedure received whenver "something" changes in the workbook. Reacts on all events. - @param AChangedItems Set with elements identifying whether workbook, worksheet - cell or selection has changed. - @param AData If AChangedItems contains nliCell then AData points to - the modified cell. + @param(AChangedItems Set with elements identifying whether workbook, worksheet + cell or selection has changed.) + @param(AData If AChangedItems contains nliCell then AData points to + the modified cell.) -------------------------------------------------------------------------------} procedure TsCellCombobox.ListenerNotification( AChangedItems: TsNotificationItems; AData: Pointer = nil); @@ -3408,6 +3396,7 @@ end; {@@ ---------------------------------------------------------------------------- Processes the selected combobox item after a new item has been selected or the item text has been edited. + Changes the selected cells according to the Mode property by calling ApplyFormatToCell. -------------------------------------------------------------------------------} @@ -3681,10 +3670,10 @@ end; Notification procedure received whenver "something" changes in the workbook. Reacts on all events. - @param AChangedItems Set with elements identifying whether workbook, worksheet - cell or selection has changed. - @param AData If AChangedItems contains nliCell then AData points to - the modified cell. + @param(AChangedItems Set with elements identifying whether workbook, worksheet + cell or selection has changed.) + @param(AData If AChangedItems contains nliCell then AData points to + the modified cell.) -------------------------------------------------------------------------------} procedure TsSpreadsheetInspector.ListenerNotification( AChangedItems: TsNotificationItems; AData: Pointer = nil); diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas index 5f783228d..bd93b24b5 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas @@ -1,5 +1,5 @@ {@@ ---------------------------------------------------------------------------- - Unit fpspreadsheet implements a grid component which can load and + Unit fpspreadsheet implements a **grid** component which can load and write data from/to FPSpreadsheet documents. Can either be used alone or in combination with a TsWorkbookSource component. @@ -336,8 +336,7 @@ type procedure TopLeftChanged; override; function TrimToCell(ACell: PCell): String; procedure ValidateInput(var Msg: TLMessage); message UM_VALIDATEINPUT; - function ValidFormula({ACol, ARow: Integer; }AExpression: String; - out AErrMsg: String): Boolean; + function ValidFormula(AExpression: String; out AErrMsg: String): Boolean; procedure WMHScroll(var message: TLMHScroll); message LM_HSCROLL; procedure WMVScroll(var message: TLMVScroll); message LM_VSCROLL; @@ -922,6 +921,7 @@ var {@@ ---------------------------------------------------------------------------- Helper procedure which creates bitmaps used for fill patterns in cell backgrounds. + The parameters are buffered in FillPatternXXXX variables to avoid unnecessary creation of the same bitmaps again and again. -------------------------------------------------------------------------------} @@ -1119,7 +1119,7 @@ end; *) @param c Color to be modified @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; type @@ -1529,6 +1529,7 @@ end; {@@ ---------------------------------------------------------------------------- The BeginUpdate/EndUpdate pair suppresses unnecessary painting of the grid. + Call BeginUpdate to stop refreshing the grid, and call EndUpdate to release 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 the sheet, to pixels as needed by the grid - @param AHeight Row height expressed in units used by the worksheet. - @result Row height in pixels. + @param AHeight Row height expressed in units used by the worksheet. + @returns Row height in pixels. -------------------------------------------------------------------------------} function TsCustomWorksheetGrid.CalcRowHeightFromSheet(AHeight: Single): Integer; var @@ -1638,8 +1639,8 @@ end; Converts the column height given in screen pixels to the units used by the worksheet. - @param AValue Column width in pixels - @result Column width expressed in units defined by the workbook. + @param AValue Column width in pixels + @returns Column width expressed in units defined by the workbook. -------------------------------------------------------------------------------} function TsCustomWorksheetGrid.CalcWorksheetColWidth(AValue: Integer): Single; var @@ -1659,8 +1660,8 @@ end; Converts the row height given in screen pixels to the units used by the worksheet. - @param AValue Row height in pixels - @result Row height expressed in units defined by the workbook. + @param AValue Row height in pixels + @returns Row height expressed in units defined by the workbook. -------------------------------------------------------------------------------} function TsCustomWorksheetGrid.CalcWorksheetRowHeight(AValue: Integer): Single; var @@ -1685,18 +1686,15 @@ end; 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 to show the complete text. + Ony for non-wordwrapped label cells and for horizontal orientation. Function returns false if text overflow needs not to be considered. - @param ACol, ARow Column and row indexes (in grid coordinates) of the cell - to be drawn + @param ACol,ARow Column and row indexes (in grid coordinates) of the cell to be drawn @param AState GridDrawState of the cell (normal, fixed, selected etc) - @param ACol1,ACol2 (output) Index of the first and last column covered by the - overflowing text - @param ARect (output) Pixel rectangle enclosing the cell and its neighbors - affected - @return TRUE if text overflow into neighbor cells is to be considered, - FALSE if not. + @param ACol1,ACol2 (output) Index of the first and last column covered by the overflowing text + @param ARect (output) Pixel rectangle enclosing the cell and its neighbors affected + @returns @TRUE if text overflow into neighbor cells is to be considered, @FALSE if not. -------------------------------------------------------------------------------} function TsCustomWorksheetGrid.CellOverflow(ACol, ARow: Integer; 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. AGridPart denotes where the cells are painted: - 0 = normal grid area - 1 = FrozenRows - 2 = FrozenCols - 3 = Top-left corner where FrozenCols and FrozenRows intersect + @unorderedlist( + @item(0 = normal grid area) + @item(1 = FrozenRows) + @item(2 = FrozenCols) + @item(3 = Top-left corner where FrozenCols and FrozenRows intersect) + ) -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.DrawCellBorders(AGridPart: Integer = 0); var @@ -2777,10 +2777,9 @@ end; @param AStart Start coordinate of the pane border line @param AEnd End coordinate of the pane border line - @param ACoord other coordinate of the border line - (y if horizontal, x if vertical) - @param IsHor Determines whether a horizontal or vertical line is drawn and, - thus, how AStart, AEnd and ACoord are interpreted. + @param ACoord Other coordinate of the border line (y if horizontal, x if vertical) + @param(IsHor Determines whether a horizontal or vertical line is drawn and, + thus, how AStart, AEnd and ACoord are interpreted.) -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.DrawFrozenPaneBorder(AStart, AEnd, ACoord: Integer; IsHor: Boolean); @@ -3499,9 +3498,9 @@ end; Returns the background color of a cell. The color is given as an index into the workbook's color palette. - @param ACol Grid column index of the cell - @param ARow Grid row index of the cell - @result Color index of the cell's background color. + @param ACol Grid column index of the cell + @param ARow Grid row index of the cell + @returns Color index of the cell's background color. -------------------------------------------------------------------------------} function TsCustomWorksheetGrid.GetBackgroundColor(ACol, ARow: Integer): TsColor; var @@ -3524,8 +3523,8 @@ end; @param ATop Index of the top row 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 - @return Color index common to all cells within the selection. If the cells' - background colors are different the value scUndefined is returned. + @return(Color index common to all cells within the selection. If the cells' + background colors are different the value scUndefined is returned.) -------------------------------------------------------------------------------} function TsCustomWorksheetGrid.GetBackgroundColors(ALeft, ATop, ARight, ABottom: Integer): TsColor; var @@ -3607,9 +3606,9 @@ end; @param ATop Index of the top row 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 - @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 - empty set is returned. + empty set is returned.) -------------------------------------------------------------------------------} function TsCustomWorksheetGrid.GetCellBorders(ALeft, ATop, ARight, ABottom: Integer): TsCellBorders; var @@ -3642,10 +3641,8 @@ end; @param ACol Grid column 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 - (see TsCellBorder) - @return CellBorderStyle record containing information on line style and - line color. + @param ABorder Identifier of the border at which the line will be drawn (see TsCellBorder) + @return CellBorderStyle record containing information on line style and line color. -------------------------------------------------------------------------------} function TsCustomWorksheetGrid.GetCellBorderStyle(ACol, ARow: Integer; ABorder: TsCellBorder): TsCellBorderStyle; @@ -3671,10 +3668,8 @@ end; @param ATop Index of the top row 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 ABorder Identifier of the border where the line will be drawn - (see TsCellBorder) - @return CellBorderStyle record containing information on line style and - line color. + @param ABorder Identifier of the border where the line will be drawn (see TsCellBorder) + @return CellBorderStyle record containing information on line style and line color. -------------------------------------------------------------------------------} function TsCustomWorksheetGrid.GetCellBorderStyles(ALeft, ATop, ARight, ABottom: Integer; ABorder: TsCellBorder): TsCellBorderStyle; @@ -3780,10 +3775,10 @@ end; {@@ ---------------------------------------------------------------------------- Returns the height (in pixels) of the cell at ACol/ARow (of the grid). - @param ACol Grid column index of the cell - @param ARow Grid row index of the cell - @result Height of the cell in pixels. Wrapped text is handled correctly. - Value contains the zoom factor. + @param(ACol Grid column index of the cell.) + @param(ARow Grid row index of the cell.) + @return(Height of the cell in pixels. Wrapped text is handled correctly. + Value contains the zoom factor.) -------------------------------------------------------------------------------} function TsCustomWorksheetGrid.GetCellHeight(ACol, ARow: Integer): Integer; var @@ -3862,6 +3857,7 @@ end; 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 modified by using the OnGetCellHint event. + Option goCellHints must be active for the cell hint feature to work. -------------------------------------------------------------------------------} function TsCustomWorksheetGrid.GetCellHintText(ACol, ARow: Integer): String; @@ -3933,8 +3929,7 @@ end; @param ACol Grid column index of the cell @param ARow Grid row index of the cell - @param ATrim If true show replacement characters if numerical data - are wider than cell. + @param ATrim If true show replacement characters if numerical data are wider than cell. @return Text to be displayed in the cell. -------------------------------------------------------------------------------} 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 ADeltaCol and ADeltaRow (one of them must be 0, the other one can only be +/-1). 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; ACell: PCell; out ABorderStyle: TsCellBorderStyle): Boolean; @@ -4158,8 +4154,7 @@ end; 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. - @param ASheets List of strings containing the names of the worksheets of - the workbook + @param ASheets List of strings containing the names of the worksheets of the workbook -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.GetSheets(const ASheets: TStrings); var @@ -4174,7 +4169,7 @@ end; {@@ ---------------------------------------------------------------------------- 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 - 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 @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 differ by 1, otherwise they are equal. Saves an "if" in some cases. - @param AGridRow Index of a grid row - @resturn Index of the corresponding worksheet row. + @param AGridRow Index of a grid row + @return Index of the corresponding worksheet row. -------------------------------------------------------------------------------} function TsCustomWorksheetGrid.GetWorksheetRow(AGridRow: Integer): Cardinal; begin @@ -4275,9 +4270,9 @@ end; Inherited from TCustomGrid. Is called when column widths or row heights have changed. Stores the new column width or row height in the worksheet. - @param IsColumn Specifies whether the changed parameter is a column width - (true) or a row height (false) - @param Index Index of the changed column or row + @param(IsColumn Specifies whether the changed parameter is a column width + (@true) or a row height (@false)) + @param(Index Index of the changed column or row) -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.HeaderSized(IsColumn: Boolean; AIndex: Integer); const @@ -4614,28 +4609,27 @@ end; {@@ ---------------------------------------------------------------------------- Internal general text drawing method. - @param AText Text to be drawn - @param AMeasureText Text used for checking if the text fits into the - text rectangle. If too large and ReplaceTooLong = true, - a series of # is drawn. - @param ARect Rectangle in which the text is drawn - @param AJustification Determines whether the text is drawn at the "start" (0), - "center" (1) or "end" (2) of the drawing rectangle. - Start/center/end are seen along the text drawing - direction. - @param ACellHorAlign Is the HorAlignment 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 ATextWrap Determines if the text can wrap into multiple lines - @param AFontIndex Font index to be used for drawing non-rich-text. - @param ARichTextParams an array of character and font index combinations for - rich-text formatting of text in cell - @param AIsRightToLeft if true cell must be drawn in right-to-left mode. + @param(AText Text to be drawn) + @param(AMeasureText Text used for checking if the text fits into the text + rectangle. If too large and ReplaceTooLong = @true, + a series of # characters is drawn.) + @param(ARect Rectangle in which the text is drawn.) + @param(AJustification Determines whether the text is drawn at the "start" (0), + "center" (1) or "end" (2) of the drawing rectangle. + Start/center/end are seen along the text drawing direction.) + @param(ACellHorAlign Is the HorAlignment 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(ATextWrap Determines if the text can wrap into multiple lines.) + @param(AFontIndex Font index to be used for drawing non-rich-text.) + @param(ARichTextParams An array of character and font index combinations + for rich-text formatting of text in cell) + @param(AIsRightToLeft If @true cell must be drawn in right-to-left mode.) - @Note The reason to separate AJustification from ACellHorAlign and ACelVertAlign is - the output of nfAccounting formatted numbers where the numbers are always - right-aligned, and the currency symbol is left-aligned. - THIS FEATURE IS CURRENTLY NO LONGER SUPPORTED. + @Note(The reason to separate AJustification from ACellHorAlign and ACelVertAlign + is the output of nfAccounting formatted numbers where the numbers are + always right-aligned, and the currency symbol is left-aligned. + THIS FEATURE IS CURRENTLY NO LONGER SUPPORTED.) -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.InternalDrawTextInCell(AText: String; ARect: TRect; ACellHorAlign: TsHorAlignment; ACellVertAlign: TsVertAlignment; @@ -4737,10 +4731,10 @@ end; Call this method only for built-in file formats. - @param AFileName Name of the file to be loaded - @param AFormat Spreadsheet file format assumed for the file - @param AWorksheetIndex Index of the worksheet to be displayed in the grid - (If empty then the active worksheet is loaded) + @param(AFileName Name of the file to be loaded) + @param(AFormat Spreadsheet file format assumed for the file) + @param(AWorksheetIndex Index of the worksheet to be displayed in the grid + (If empty then the active worksheet is loaded)) -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.LoadFromSpreadsheetFile(AFileName: string; AFormat: TsSpreadsheetFormat; AWorksheetIndex: Integer); @@ -4759,11 +4753,11 @@ end; Call this method for both built-in and user-provided file formats. - @param AFileName Name of the file to be loaded - @param AFormatID Spreadsheet file format identifier assumed for the - file (automatic detection if empty) - @param AWorksheetIndex Index of the worksheet to be displayed in the grid - (If empty then the active worksheet is loaded) + @param(AFileName Name of the file to be loaded) + @param(AFormatID Spreadsheet file format identifier assumed for the + file (automatic detection if empty)) + @param(AWorksheetIndex Index of the worksheet to be displayed in the grid + (If empty then the active worksheet is loaded)) -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.LoadFromSpreadsheetFile(AFileName: string; 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 with the specified sheet index. The file format is determined automatically. - @param AFileName Name of the file to be loaded - @param AWorksheetIndex Index of the worksheet to be shown in the grid - (If empty then the active worksheet is loaded) - @param AFormatID Spreadsheet file format identifier assumed for the - file (automatic detection if empty) + @param(AFileName Name of the file to be loaded) + @param(AWorksheetIndex Index of the worksheet to be shown in the grid + (If empty then the active worksheet is loaded)) + @param(AFormatID Spreadsheet file format identifier assumed for the + file (automatic detection if empty)) -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.LoadSheetFromSpreadsheetFile(AFileName: String; AWorksheetIndex: Integer = -1; AFormatID: TsSpreadFormatID = sfidUnknown); @@ -4800,12 +4794,12 @@ end; {@@ ---------------------------------------------------------------------------- Loads an existing workbook into the grid. - @param AWorkbook Workbook that had been created/loaded before. - @param AWorksheetIndex Index of the worksheet to be shown in the grid - (If empty then the active worksheet is loaded) + @param(AWorkbook Workbook that had been created/loaded before. ) + @param(AWorksheetIndex Index of the worksheet to be shown in the grid + (If empty then the active worksheet is loaded)) - @Note THE CALLING PROCEDURE MUST NOT DESTROY THE WORKBOOK! The workbook will - be destroyed by the workbook source. + @Note(THE CALLING PROCEDURE MUST NOT DESTROY THE WORKBOOK! + The workbook will be destroyed by the workbook source.) -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.LoadFromWorkbook(AWorkbook: TsWorkbook; AWorksheetIndex: Integer = -1); @@ -5303,13 +5297,11 @@ end; Call this method only for built-in file formats. - @param AFileName Name of the file to which the workbook is to be - saved. - @param AFormat Spreadsheet file format in which the file is to be - saved. - @param AOverwriteExisting If the file already exists, it is overwritten in - the case of AOverwriteExisting = true, or an - exception is raised if AOverwriteExisting = false + @param(AFileName Name of the file to which the workbook is to be saved.) + @param(AFormat Spreadsheet file format in which the file is to be saved.) + @param(AOverwriteExisting If the file already exists, it is overwritten in the + case of AOverwriteExisting = @true, or an exception + is raised if AOverwriteExisting = @false) -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.SaveToSpreadsheetFile(AFileName: String; AFormat: TsSpreadsheetFormat; AOverwriteExisting: Boolean = true); @@ -5323,13 +5315,12 @@ end; 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 - saved. - @param AFormatID Identifier for the spreadsheet file format in - which the file is to be saved. - @param AOverwriteExisting If the file already exists, it is overwritten in - the case of AOverwriteExisting = true, or an - exception is raised if AOverwriteExisting = false + @param(AFileName Name of the file to which the workbook is to be saved.) + @param(AFormatID Identifier for the spreadsheet file format in which + the file is to be saved.) + @param(AOverwriteExisting If the file already exists, it is overwritten in + the case of AOverwriteExisting = @true, or an + exception is raised if AOverwriteExisting = @false) -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.SaveToSpreadsheetFile(AFileName: String; AFormatID: TsSpreadFormatID; AOverwriteExisting: Boolean = true); @@ -5342,13 +5333,11 @@ end; 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. - @param AFileName Name of the file to which the workbook is to be - saved - If the file format is not known it is written - as BIFF8/XLS. - @param AOverwriteExisting If this file already exists it is overwritten if - AOverwriteExisting = true, or an exception is - raised if AOverwriteExisting = false. + @param(AFileName Name of the file to which the workbook is to be saved. + If the file format is not known it is written as BIFF8/XLS.) + @param(AOverwriteExisting If this file already exists it is overwritten if + AOverwriteExisting = @true, or an exception is raised + if AOverwriteExisting = @false.) -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.SaveToSpreadsheetFile(AFileName: String; AOverwriteExisting: Boolean = true); @@ -5644,13 +5633,13 @@ end; Sort direction is determined by the property "SortOrder". Other sorting criteria are "case-sensitive" and "numbers first". - @param AColSorting If true the grid is sorted from top to bottom and the - next parameter, "Index", refers to a column. Otherweise - 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) - which is sorted. - @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(AColSorting If @true the grid is sorted from top to bottom and the + next parameter, "Index", refers to a column. Otherwise + 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) + which is sorted.) + @param(AIndxFrom Sorting starts 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; AIndex, AIndxFrom, AIndxTo:Integer); @@ -5673,7 +5662,6 @@ begin ); end; - {@@ ---------------------------------------------------------------------------- Converts a coordinate given in workbook units to pixels using the current screen resolution @@ -5687,7 +5675,8 @@ begin 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; begin @@ -5696,7 +5685,7 @@ begin 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: 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 @@ -5881,7 +5870,7 @@ end; 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 iterating over all cells in this row. This happens also if the parameter - AEnforceCalcRowHeight is true. + AEnforceCalcRowHeight is @true. -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.UpdateRowHeight(ARow: Integer; AEnforceCalcRowHeight: Boolean = false); @@ -7005,7 +6994,7 @@ begin InvalidateGrid; 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); begin if AValue = FShowFormulas then @@ -7014,7 +7003,7 @@ begin InvalidateGrid; end; -{ Shows / hides the worksheet's grid lines } +{@@ Shows/hides the worksheet's grid lines } procedure TsCustomWorksheetGrid.SetShowGridLines(AValue: Boolean); begin if AValue = GetShowGridLines then @@ -7032,7 +7021,7 @@ begin Worksheet.Options := Worksheet.Options - [soShowGridLines]; end; -{ Shows / hides the worksheet's row and column headers. } +{@@ Shows/hides the worksheet's row and column headers. } procedure TsCustomWorksheetGrid.SetShowHeaders(AValue: Boolean); var hdrCount: Integer; @@ -7190,6 +7179,13 @@ begin 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; out AErrMsg: String): Boolean; var