Skip to content

Commit fedb344

Browse files
committed
[FIX] xlsx: ignore charts without data set
When we parse the XML and extract the data sets, we expect an element `c:val`. But this element is optional according to the spec. It leads to a chart with a `dataSets` property being an empty array. It crashes (17.0) or the chart is ignored (18.0) later down the line because a chart without any data set makes no sense. I must admit I do not fully understand what are those charts without data set in excel. When importing the file in Excel Online or Google Sheet, there's no chart... With this commit, we ignore those charts as well. closes #5423 Opw: 4443811 Task: 4460515 X-original-commit: 9037b62 Signed-off-by: Rémi Rahir (rar) <[email protected]> Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
1 parent 0277eb9 commit fedb344

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/xlsx/conversion/figure_conversion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function convertFigure(
6363
}
6464

6565
function isChartData(data: ExcelChartDefinition | ExcelImage): data is ExcelChartDefinition {
66-
return "dataSets" in data;
66+
return "dataSets" in data && data.dataSets.length > 0;
6767
}
6868

6969
function isImageData(data: ExcelChartDefinition | ExcelImage): data is ExcelImage {

0 commit comments

Comments
 (0)