You've already forked lazarus-ccr
fpspreadsheet: XLSX reader supports expression conditional format. Add test case for it.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7546 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -488,21 +488,31 @@ var
|
||||
p: Integer;
|
||||
s: String;
|
||||
f: TsRelFlags;
|
||||
singleCell: Boolean = false;
|
||||
begin
|
||||
Result := True;
|
||||
|
||||
// First find the colon
|
||||
p := pos(':', AStr);
|
||||
if p = 0 then exit(false);
|
||||
if p = 0 then //exit(false);
|
||||
begin
|
||||
singleCell := true;
|
||||
Result := ParseCellString(AStr, AFirstcellRow, AFirstCellCol, f);
|
||||
if not Result then exit;
|
||||
ALastCellRow := AFirstCellRow;
|
||||
ALastCellCol := AFirstCellCol;
|
||||
AFlags := f;
|
||||
end else
|
||||
begin
|
||||
// Analyze part after the colon
|
||||
s := copy(AStr, p+1, Length(AStr));
|
||||
Result := ParseCellString(s, ALastCellRow, ALastCellCol, f);
|
||||
if not Result then exit;
|
||||
|
||||
// Analyze part after the colon
|
||||
s := copy(AStr, p+1, Length(AStr));
|
||||
Result := ParseCellString(s, ALastCellRow, ALastCellCol, f);
|
||||
if not Result then exit;
|
||||
|
||||
// Analyze part before the colon
|
||||
s := copy(AStr, 1, p-1);
|
||||
Result := ParseCellString(s, AFirstCellRow, AFirstCellCol, AFlags);
|
||||
// Analyze part before the colon
|
||||
s := copy(AStr, 1, p-1);
|
||||
Result := ParseCellString(s, AFirstCellRow, AFirstCellCol, AFlags);
|
||||
end;
|
||||
|
||||
// Add flags of 2nd part
|
||||
if rfRelRow in f then Include(AFlags, rfRelRow2);
|
||||
|
@@ -81,6 +81,8 @@ type
|
||||
ARange: TsCellRange);
|
||||
procedure ReadCFDataBars(ANode: TDOMNode; AWorksheet: TsBasicWorksheet;
|
||||
ARange: TsCellRange);
|
||||
procedure ReadCFExpression(ANode: TDOMNode; AWorksheet: TsBasicWorksheet;
|
||||
ARange: TsCellRange; AFormatIndex: Integer);
|
||||
procedure ReadCFMisc(ANode: TDOMNode; AWorksheet: TsBasicWorksheet;
|
||||
ARange: TsCellRange; AFormatIndex: Integer);
|
||||
procedure ReadCFTop10(ANode: TDOMNode; AWorksheet: TsBasicWorksheet;
|
||||
@@ -1509,6 +1511,29 @@ begin
|
||||
sheet.WriteDataBars(ARange, clr, vk[0], v[0], vk[1], v[1]);
|
||||
end;
|
||||
|
||||
procedure TsSpreadOOXMLReader.ReadCFExpression(ANode: TDOMNode;
|
||||
AWorksheet: TsBasicWorksheet; ARange: TsCellRange; AFormatIndex: Integer);
|
||||
var
|
||||
sheet: TsWorksheet;
|
||||
nodeName: String;
|
||||
s: String;
|
||||
begin
|
||||
sheet := TsWorksheet(AWorksheet);
|
||||
|
||||
ANode := ANode.FirstChild;
|
||||
while ANode <> nil do
|
||||
begin
|
||||
nodeName := ANode.NodeName;
|
||||
if nodeName = 'formula' then
|
||||
begin
|
||||
s := GetNodeValue(ANode);
|
||||
sheet.WriteConditionalCellFormat(ARange, cfcExpression, s, AFormatIndex);
|
||||
exit;
|
||||
end;
|
||||
ANode := ANode.NextSibling;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TsSpreadOOXMLReader.ReadCFMisc(ANode: TDOMNode;
|
||||
AWorksheet: TsBasicWorksheet; ARange: TsCellRange; AFormatIndex: Integer);
|
||||
var
|
||||
@@ -1857,6 +1882,8 @@ begin
|
||||
ReadCFMisc(childNode, AWorksheet, range, fmtIdx);
|
||||
'containsText', 'notContainsText', 'beginsWith', 'endsWith':
|
||||
ReadCFMisc(childNode, AWorksheet, range, fmtIdx);
|
||||
'expression':
|
||||
ReadCFExpression(childNode, AWorksheet, range, fmtIdx);
|
||||
'colorScale':
|
||||
ReadCFColorRange(childNode, AWorksheet, range);
|
||||
'dataBar':
|
||||
|
Reference in New Issue
Block a user