Hi,
There is a problem saving charts that have Multi Level Category Axis Labels. After opening the excel and saving to stream with the RefreshChartCache = true option, that stream will no longer contain the correct xml for the chart.
Steps to reproduce:
- Open the excel from file
- Set the RefreshChartCache option to True in OoxmlSaveOptions
- Save the excel to stream using the OoxmlSaveOptions
- Save the stream to file using File.WriteAllBytes(filename, byte array)
- Unzip the saved file
- Navigate to charts and open chart1.xml
Result:
The following structure is found for category axis:
<c:cat>
<c:strRef>
<c:f>Sheet1!$B$5:$G$7</c:f>
<c:strCache>
<c:ptCount val=“6” />
<c:pt idx=“0”>
<c:v>A
Label1</c:v>
</c:pt>
…
Expected:
<c:cat>
<c:multiLvlStrRef>
<c:f>Sheet1!$B$5:$G$7</c:f>
<c:multiLvlStrCache>
<c:ptCount val=“6”/>
<c:lvl>
<c:pt idx=“0”>
<c:v>A</c:v>
</c:pt>
…
</c:lvl>
<c:lvl>
<c:pt idx=“0”>
<c:v>Label1</c:v>
</c:pt>
…
</c:lvl>
</c:multiLvlStrCache>
</c:multiLvlStrRef>
</c:cat>
Attached sample code, sample file and result file.Aspose.zip (24.5 KB)