fpspreadsheet: Add to the demo a test of conditional format with two rules in the same cell range

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7512 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-07-01 16:14:35 +00:00
parent efa8009d96
commit fba35bacb4

View File

@ -21,7 +21,7 @@ begin
sh.WriteDefaultColWidth(15, suMillimeters);
sh.WriteText(0, 0, 'Condition');
sh.WriteColWidth(0, 60, suMillimeters);
sh.WriteColWidth(0, 70, suMillimeters);
sh.WriteText(0, 1, 'Format');
sh.WriteColWidth(1, 90, suMillimeters);
sh.WriteText(0, 2, 'Test values');
@ -265,6 +265,18 @@ begin
fmtIdx := wb.AddCellFormat(fmt);
sh.WriteConditionalCellFormat(Range(row, 2, row, lastCol), cfcNotContainsErrors, fmtIdx);
// Two rules in the same conditional format
inc(row);
sh.WriteText(row, 0, 'Two rules: #1: equal to 5, #2: equal to 3');
sh.WriteText(row, 1, '#1: background yellow, #2: background green');
InitFormatRecord(fmt);
fmt.SetBackgroundColor(scYellow);
fmtIdx := wb.AddCellFormat(fmt);
sh.WriteConditionalCellFormat(Range(row, 2, row, lastCol), cfcEqual, 5, fmtIdx);
fmt.SetBackgroundColor(scGreen);
fmtIdx := wb.AddCellFormat(fmt);
sh.WriteConditionalCellFormat(Range(row, 2, row, lastCol), cfcEqual, 3, fmtIdx);
{ ------ Save workbook to file-------------------------------------------- }
wb.WriteToFile('test.xlsx', true);
wb.WriteToFile('test.ods', true);