You've already forked lazarus-ccr
fpspreadsheet: xlsx writer supports conditional formatting for duplicate/unique values.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7500 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -85,6 +85,16 @@ begin
|
|||||||
fmtIdx := wb.AddCellFormat(fmt);
|
fmtIdx := wb.AddCellFormat(fmt);
|
||||||
sh.WriteConditionalCellFormat(Range(0, 0, 100, 100), cfcContainsErrors, fmtIdx);
|
sh.WriteConditionalCellFormat(Range(0, 0, 100, 100), cfcContainsErrors, fmtIdx);
|
||||||
|
|
||||||
|
|
||||||
|
{ ------ 6th conditional format: unique/duplicate values ----------------- }
|
||||||
|
sh.WriteNumber(0, 1, 1.0);
|
||||||
|
sh.WriteNumber(1, 1, 99.0);
|
||||||
|
InitFormatRecord(fmt);
|
||||||
|
fmt.SetBackgroundColor(scSilver);
|
||||||
|
sh.WriteConditionalCellFormat(Range(0, 0, 1, 1), cfcUnique, wb.AddCellFormat(fmt));
|
||||||
|
fmt.SetBackgroundColor(scGreen);
|
||||||
|
sh.WriteConditionalCellFormat(Range(0, 0, 1, 1), cfcDuplicate, wb.AddCellFormat(fmt));
|
||||||
|
|
||||||
{ ------ Save workbook to file-------------------------------------------- }
|
{ ------ Save workbook to file-------------------------------------------- }
|
||||||
wb.WriteToFile('test.xlsx', true);
|
wb.WriteToFile('test.xlsx', true);
|
||||||
finally
|
finally
|
||||||
|
@@ -3360,7 +3360,7 @@ const
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
dxfID: Integer;
|
dxfID: Integer;
|
||||||
aveStr, stdDevStr, eqAveStr, opStr: String;
|
typeStr, aveStr, stdDevStr, eqAveStr, opStr: String;
|
||||||
firstCellOfRange: String;
|
firstCellOfRange: String;
|
||||||
begin
|
begin
|
||||||
dxfID := -1;
|
dxfID := -1;
|
||||||
@@ -3424,6 +3424,16 @@ begin
|
|||||||
opStr
|
opStr
|
||||||
]));
|
]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
cfcDuplicate, cfcUnique:
|
||||||
|
begin
|
||||||
|
if ARule.Condition = cfcUnique then
|
||||||
|
typeStr := 'uniqueValues'
|
||||||
|
else
|
||||||
|
typeStr := 'duplicateValues';
|
||||||
|
AppendToStream(AStream, Format(
|
||||||
|
'<cfRule type="%s" dxfId="%d" priority="%d" />', [typeStr, dxfID, APriority]));
|
||||||
|
end;
|
||||||
else
|
else
|
||||||
FWorkbook.AddErrorMsg('ConditionalFormat operator not supported.');
|
FWorkbook.AddErrorMsg('ConditionalFormat operator not supported.');
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user