fpspreadsheet: Add TCell record helper to access cell comments from the cell

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3946 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-02-15 22:18:38 +00:00
parent 54c2af0154
commit f34b79c6fd
2 changed files with 15 additions and 6 deletions

View File

@ -16,6 +16,7 @@ type
function GetBorderStyle(const ABorder: TsCellBorder): TsCellBorderStyle;
function GetBorderStyles: TsCellBorderStyles;
function GetCellFormat: TsCellFormat;
function GetComment: String;
function GetFont: TsFont;
function GetFontIndex: integer;
function GetHorAlignment: TsHorAlignment;
@ -30,6 +31,7 @@ type
procedure SetBorderStyle(const ABorder: TsCellBorder; const AValue: TsCellBorderStyle);
procedure SetBorderStyles(const AValue: TsCellBorderStyles);
procedure SetCellFormat(const AValue: TsCellFormat);
procedure SetComment(const AValue: String);
procedure SetFontIndex(const AValue: Integer);
procedure SetHorAlignment(const AValue: TsHorAlignment);
procedure SetNumberFormat(const AValue: TsNumberFormat);
@ -99,6 +101,11 @@ begin
Result := Workbook.GetCellFormat(FormatIndex);
end;
function TCellHelper.GetComment: String;
begin
Result := Worksheet.ReadComment(@self);
end;
function TCellHelper.GetFont: TsFont;
begin
Result := Worksheet.ReadCellFont(@self);
@ -184,6 +191,11 @@ begin
Worksheet.WriteCellFormat(@self, AValue);
end;
procedure TCellHelper.SetComment(const AValue: String);
begin
Worksheet.WriteComment(@self, AValue);
end;
procedure TCellHelper.SetFontIndex(const AValue: Integer);
begin
Worksheet.WriteFont(@self, AValue);

View File

@ -103,9 +103,9 @@ type
PCol = ^TCol;
{@@ The record TsComment contains a comment attached to a cell.
@param Row (0-based) index of the row containing the cell with the comment
@param Col (0-based) index of the column containing the coll with the comment
@param Text Comment text }
@param Row (0-based) index of the row with the cell
@param Col (0-based) index of the column with the cell
@param Text Comment text }
TsComment = record
Row, Col: Cardinal;
Text: String;
@ -259,9 +259,6 @@ type
function WriteCellValueAsString(ARow, ACol: Cardinal; AValue: String): PCell; overload;
procedure WriteCellValueAsString(ACell: PCell; AValue: String); overload;
// function WriteComment(ARow, ACol: Cardinal; const AComment: String): PCell; overload;
// procedure WriteComment(ACell: PCell; const AComment: String); overload;
function WriteCurrency(ARow, ACol: Cardinal; AValue: Double;
ANumFormat: TsNumberFormat = nfCurrency; ADecimals: Integer = 2;
ACurrencySymbol: String = '?'; APosCurrFormat: Integer = -1;