You've already forked lazarus-ccr
fpspreadsheet: Fix application of cell format to a cell range by TsNumberFormatAction.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7064 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -273,6 +273,7 @@ type
|
|||||||
private
|
private
|
||||||
FNumberFormat: TsNumberFormat;
|
FNumberFormat: TsNumberFormat;
|
||||||
FNumberFormatStr: string;
|
FNumberFormatStr: string;
|
||||||
|
FCustomNumberFormatStr: String;
|
||||||
FOnGetNumFormatStr: TsNumFormatStrEvent;
|
FOnGetNumFormatStr: TsNumFormatStrEvent;
|
||||||
procedure SetNumberFormat(AValue: TsNumberFormat);
|
procedure SetNumberFormat(AValue: TsNumberFormat);
|
||||||
procedure SetNumberFormatStr(AValue: String);
|
procedure SetNumberFormatStr(AValue: String);
|
||||||
@ -282,6 +283,7 @@ type
|
|||||||
procedure UpdateCaptionAndHint;
|
procedure UpdateCaptionAndHint;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
procedure ExecuteTarget(Target: TObject); override;
|
||||||
published
|
published
|
||||||
property NumberFormat: TsNumberFormat
|
property NumberFormat: TsNumberFormat
|
||||||
read FNumberFormat write SetNumberFormat default nfGeneral;
|
read FNumberFormat write SetNumberFormat default nfGeneral;
|
||||||
@ -1221,7 +1223,7 @@ begin
|
|||||||
Caption := rsNumberFormatCaption_General;
|
Caption := rsNumberFormatCaption_General;
|
||||||
Hint := rsNumberFormatHint_General;
|
Hint := rsNumberFormatHint_General;
|
||||||
GroupIndex := 1411141258; // Date/time when this code was written
|
GroupIndex := 1411141258; // Date/time when this code was written
|
||||||
AutoCheck := true;
|
//AutoCheck := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TsNumberFormatAction.ApplyFormatToCell(ACell: PCell);
|
procedure TsNumberFormatAction.ApplyFormatToCell(ACell: PCell);
|
||||||
@ -1230,17 +1232,12 @@ var
|
|||||||
nfstr: String;
|
nfstr: String;
|
||||||
begin
|
begin
|
||||||
if Checked then
|
if Checked then
|
||||||
begin
|
|
||||||
if (FNumberFormat = nfCustom) and Assigned(FOnGetNumFormatStr) then
|
|
||||||
begin
|
|
||||||
Worksheet.ReadNumFormat(ACell, nf, nfstr);
|
|
||||||
FOnGetNumFormatStr(self, Workbook, nfstr);
|
|
||||||
nf := nfCustom;
|
|
||||||
end else
|
|
||||||
begin
|
begin
|
||||||
nf := FNumberFormat;
|
nf := FNumberFormat;
|
||||||
|
if FNumberFormat = nfCustom then
|
||||||
|
nfstr := FCustomNumberFormatStr
|
||||||
|
else
|
||||||
nfstr := FNumberFormatStr;
|
nfstr := FNumberFormatStr;
|
||||||
end;
|
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
nf := nfGeneral;
|
nf := nfGeneral;
|
||||||
@ -1252,6 +1249,23 @@ begin
|
|||||||
Worksheet.WriteNumberFormat(ACell, nf, nfstr);
|
Worksheet.WriteNumberFormat(ACell, nf, nfstr);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TsNumberFormatAction.ExecuteTarget(Target: TObject);
|
||||||
|
var
|
||||||
|
nf: TsNumberFormat;
|
||||||
|
nfstr: String;
|
||||||
|
begin
|
||||||
|
if (FNumberFormat = nfCustom) and Assigned(FOnGetNumFormatStr) then
|
||||||
|
begin
|
||||||
|
Worksheet.ReadNumFormat(ActiveCell, nf, nfstr);
|
||||||
|
FOnGetNumFormatStr(self, Workbook, nfstr);
|
||||||
|
FCustomNumberFormatStr := nfstr;
|
||||||
|
Checked := true;
|
||||||
|
end else
|
||||||
|
Checked := not Checked;
|
||||||
|
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TsNumberFormatAction.ExtractFromCell(ACell: PCell);
|
procedure TsNumberFormatAction.ExtractFromCell(ACell: PCell);
|
||||||
var
|
var
|
||||||
nf: TsNumberFormat;
|
nf: TsNumberFormat;
|
||||||
|
Reference in New Issue
Block a user