Add the function of generating conditional format.
Demo:
procedure TForm1.Button1Click(Sender: TObject);
var
fDifferentialFormat: TsDifferentialFormat;
fConditionalFormat: TsCellConditionalFormat;
begin
with fDifferentialFormat do
begin
bgColor:='FF92D050';
end;
sWorksheetGrid1.Workbook.AddDifferentialFormat(fDifferentialFormat);
with fConditionalFormat do
begin
sqref := 'A2';
cfRuleType:='expression';
dxfId:=0;
priority:=1;
formula:='$A1=1';
end;
sWorksheetGrid1.Worksheet.AddCellConditionalFormat(fConditionalFormat);
sWorksheetGrid1.SaveToSpreadsheetFile('test.xlsx');
end;
Add to fpsTypes.pas:
TsCellConditionalFormat
PsCellConditionalFormat
TsDifferentialFormat
PsDifferentialFormat
Add to fpsclasses.pas:
TsConditionalFormatList
TsDifferentialFormatList
Add to fpspreadsheet:
TsWorksheet:
FConditionalFormats: TsConditionalFormatList;
function AddCellConditionalFormat(const AValue: TsCellConditionalFormat): Integer;
function GetCellConditionalFormat(AIndex: Integer): TsCellConditionalFormat;
function GetNumCellConditionalFormats: Integer;
TsWorkbook:
FDifferentialFormatList: TsDifferentialFormatList;
function AddDifferentialFormat(const AValue: TsDifferentialFormat): Integer;
function GetDifferentialFormat(AIndex: Integer): TsDifferentialFormat;
function GetNumDifferentialFormats: Integer;
Add to xlsxooxml.pas:
TsSpreadOOXMLWriter:
procedure WriteConditionalFormats(AStream: TStream; AWorksheet: TsBasicWorksheet);
procedure WriteDifferentialFormattingList(AStream: TStream);