You've already forked lazarus-ccr
fpspreadsheet: Add property NumberFormats to TsWorksheetGrid.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4433 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -101,6 +101,7 @@ type
|
|||||||
function GetHorAlignments(ARect: TGridRect): TsHorAlignment;
|
function GetHorAlignments(ARect: TGridRect): TsHorAlignment;
|
||||||
function GetHyperlink(ACol, ARow: Integer): String;
|
function GetHyperlink(ACol, ARow: Integer): String;
|
||||||
function GetNumberFormat(ACol, ARow: Integer): String;
|
function GetNumberFormat(ACol, ARow: Integer): String;
|
||||||
|
function GetNumberFormats(ARect: TGridRect): String;
|
||||||
function GetShowGridLines: Boolean;
|
function GetShowGridLines: Boolean;
|
||||||
function GetShowHeaders: Boolean;
|
function GetShowHeaders: Boolean;
|
||||||
function GetTextRotation(ACol, ARow: Integer): TsTextRotation;
|
function GetTextRotation(ACol, ARow: Integer): TsTextRotation;
|
||||||
@ -137,6 +138,7 @@ type
|
|||||||
procedure SetHorAlignments(ARect: TGridRect; AValue: TsHorAlignment);
|
procedure SetHorAlignments(ARect: TGridRect; AValue: TsHorAlignment);
|
||||||
procedure SetHyperlink(ACol, ARow: Integer; AValue: String);
|
procedure SetHyperlink(ACol, ARow: Integer; AValue: String);
|
||||||
procedure SetNumberFormat(ACol, ARow: Integer; AValue: String);
|
procedure SetNumberFormat(ACol, ARow: Integer; AValue: String);
|
||||||
|
procedure SetNumberFormats(ARect: TGridRect; AValue: String);
|
||||||
procedure SetReadFormulas(AValue: Boolean);
|
procedure SetReadFormulas(AValue: Boolean);
|
||||||
procedure SetShowGridLines(AValue: Boolean);
|
procedure SetShowGridLines(AValue: Boolean);
|
||||||
procedure SetShowHeaders(AValue: Boolean);
|
procedure SetShowHeaders(AValue: Boolean);
|
||||||
@ -371,6 +373,10 @@ type
|
|||||||
{@@ Number format (as Excel string) to be applied to cell at column ACol and row ARow. }
|
{@@ Number format (as Excel string) to be applied to cell at column ACol and row ARow. }
|
||||||
property NumberFormat[ACol, ARow: Integer]: String
|
property NumberFormat[ACol, ARow: Integer]: String
|
||||||
read GetNumberFormat write SetNumberFormat;
|
read GetNumberFormat write SetNumberFormat;
|
||||||
|
{@@ Number format (as Excel string) to be applied to all cells within the
|
||||||
|
range of column/row indexes defined by the rectangle. }
|
||||||
|
property NumberFormats[ARect: TGridRect]: String
|
||||||
|
read GetNumberFormats write SetNumberFormats;
|
||||||
{@@ Rotation of the text in the cell at column ACol and row ARow. }
|
{@@ Rotation of the text in the cell at column ACol and row ARow. }
|
||||||
property TextRotation[ACol, ARow: Integer]: TsTextRotation
|
property TextRotation[ACol, ARow: Integer]: TsTextRotation
|
||||||
read GetTextRotation write SetTextRotation;
|
read GetTextRotation write SetTextRotation;
|
||||||
@ -4550,6 +4556,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TsCustomWorksheetGrid.GetNumberFormats(ARect: TGridRect): String;
|
||||||
|
var
|
||||||
|
c, r: Integer;
|
||||||
|
nfs: String;
|
||||||
|
begin
|
||||||
|
nfs := GetNumberformat(ARect.Left, ARect.Top);
|
||||||
|
for r := ARect.Left to ARect.Right do
|
||||||
|
for c := ARect.Top to ARect.Bottom do
|
||||||
|
if nfs <> GetNumberFormat(c, r) then
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
Result := nfs;
|
||||||
|
end;
|
||||||
|
|
||||||
function TsCustomWorksheetGrid.GetShowGridLines: Boolean;
|
function TsCustomWorksheetGrid.GetShowGridLines: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (Options * [goHorzLine, goVertLine] <> []);
|
Result := (Options * [goHorzLine, goVertLine] <> []);
|
||||||
@ -5002,6 +5024,20 @@ begin
|
|||||||
Worksheet.WriteNumberFormat(GetWorksheetRow(ARow), GetWorksheetCol(ACol), nfCustom, AValue);
|
Worksheet.WriteNumberFormat(GetWorksheetRow(ARow), GetWorksheetCol(ACol), nfCustom, AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TsCustomWorksheetGrid.SetNumberFormats(ARect: TGridRect; AValue: String);
|
||||||
|
var
|
||||||
|
c,r: Integer;
|
||||||
|
begin
|
||||||
|
BeginUpdate;
|
||||||
|
try
|
||||||
|
for c := ARect.Left to ARect.Right do
|
||||||
|
for r := ARect.Top to ARect.Bottom do
|
||||||
|
SetNumberFormat(c, r, AValue);
|
||||||
|
finally
|
||||||
|
EndUpdate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TsCustomWorksheetGrid.SetReadFormulas(AValue: Boolean);
|
procedure TsCustomWorksheetGrid.SetReadFormulas(AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
FReadFormulas := AValue;
|
FReadFormulas := AValue;
|
||||||
|
Reference in New Issue
Block a user