fpspreadsheet: Add writing of error-related conditional formatting conditions to xlsx writer.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7499 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-06-26 11:18:30 +00:00
parent 8a30aacadb
commit 9a71231010
2 changed files with 22 additions and 5 deletions

View File

@@ -70,6 +70,21 @@ begin
fmtIdx := wb.AddCellFormat(fmt);
sh.WriteConditionalCellFormat(Range(0, 4, 5, 4), cfcContainsText, 'bc', fmtIdx);
{ ------ 5th conditional format: containsErrors -------------------------- }
sh.WriteFormula(0, 6, '=1.0/0.0');
sh.WriteFormula(1, 6, '=1.0/1.0');
sh.WriteFormula(2, 6, '=1.0/2.0');
InitFormatRecord(fmt);
fmt.SetBackgroundColor(scGreen);
fmtIdx := wb.AddCellFormat(fmt);
sh.WriteConditionalCellFormat(Range(0, 6, 5, 6), cfcNotContainsErrors, fmtIdx);
// Condition for ContainsErrors after NoContainsErrors to get higher priority
fmt.SetBackgroundColor(scRed);
fmtIdx := wb.AddCellFormat(fmt);
sh.WriteConditionalCellFormat(Range(0, 0, 100, 100), cfcContainsErrors, fmtIdx);
{ ------ Save workbook to file-------------------------------------------- }
wb.WriteToFile('test.xlsx', true);
finally