fpspreadsheet: Avoid writing duplicate conditional formatting styles to "styles.xml" of ods file.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7511 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-07-01 16:08:11 +00:00
parent 7f80fea142
commit efa8009d96
2 changed files with 24 additions and 15 deletions

View File

@@ -18,12 +18,12 @@ begin
wb := TsWorkbook.Create;
try
sh := wb.AddWorksheet('test');
sh.WriteDefaultColWidth(20, suMillimeters);
sh.WriteDefaultColWidth(15, suMillimeters);
sh.WriteText(0, 0, 'Condition');
sh.WriteColWidth(0, 60, suMillimeters);
sh.WriteText(0, 1, 'Format');
sh.WriteColWidth(1, 70, suMillimeters);
sh.WriteColWidth(1, 90, suMillimeters);
sh.WriteText(0, 2, 'Test values');
row := 2;
@@ -49,7 +49,7 @@ begin
sh.WriteFormula(i, 18, '=1.0/1.0');
end;
lastCol := 18;
(*
// conditional format #1: equal to number constant
sh.WriteText(row, 0, 'equal to constant 5');
sh.WriteText(row, 1, 'background yellow');
@@ -255,11 +255,11 @@ begin
fmt.SetBackgroundColor(scRed);
fmtIdx := wb.AddCellFormat(fmt);
sh.WriteConditionalCellFormat(Range(row, 2, row, lastCol), cfcContainsErrors, fmtIdx);
*)
// conditional format #6: no errors
inc(row);
sh.WriteText(row, 0, 'no errors');
sh.WriteText(row, 1, 'background red');
sh.WriteText(row, 1, 'background yellow, font "Courier New"/red/bold/14');
fmt.SetBackgroundColor(scYellow);
fmt.SetFont(wb.AddFont('Courier New', 14, [fssBold], scRed));
fmtIdx := wb.AddCellFormat(fmt);