Hi,
This issue seems related to CELLSNET-43500 but it’s not the same because in this case we don’t get any NullRefrenceException.
When opening the attached Excel file with Aspose.Cells, saving to a stream using OoxmlSaveOptions.RefreshChartCache = true then exporting the chart to Word using OpenXML the aspect of the chart is affected. This is not happening if we don’t use RefreshChartCache = true. If we save the content of the stream to a file as byte array Excel will report the file is corrupted and after repairing the chart is removed.
All these scanarios are working fine as long as we don’t use RefreshChartCache = true.
For reproducing the issue plase use the attached files and the following code:
using (var conversionStream = new MemoryStream())
{
var sourceWorkbook = new Workbook(“source.xlsx”);
var saveOptions = new OoxmlSaveOptions(SaveFormat.Xlsx) {RefreshChartCache = true};
sourceWorkbook.Save(conversionStream, saveOptions);
//then using OpenXML here to export the chart to Word;
//the result of the export is in the attached Word document;
//everything is fine if we don’t use RefreshChartCache = true
//Saving the content to a file as byte array;
//Excel will report the file is corrupted and after repairing the chart is removed
File.WriteAllBytes(“output.xlsx”, conversionStream.ToArray());
}
If more details/clarifications are needed please let me know, thanks.
Best regards,
Aurelian Iordache
Software Developer
IBM Romania
Hi Aurelian,
Hi Babar,
I checked with Aspose.Cells v.8.4.1.0 and there is still a issue with the aspect of the chart exported to Word. Unfortunately I can’t provide the code we use for OpenXML export to Word because I don’t have approval to do this but I’ll try to explain the problem here.
Please use the attached XLSX file and the following code:
private static void Main()
{
//path to the Excel file containing the chart we will export to Word
const string sourceFileExcel = “BubbleTest.xlsx”;
var content = File.ReadAllBytes(sourceFileExcel);
var resultForRefreshChartCacheTrue = RefreshWorbookChartCache(content, true);
File.WriteAllBytes(“resultForRefreshChartCacheTrue.xlsx”, resultForRefreshChartCacheTrue);
var resultForRefreshChartCacheFalse = RefreshWorbookChartCache(content, false);
File.WriteAllBytes(“resultForRefreshChartCacheFalse.xlsx”, resultForRefreshChartCacheFalse);
}
private static byte[] RefreshWorbookChartCache(byte[] workbookContent, bool refreshChartCache)
{
using (var conversionStream = new MemoryStream())
{
using (var tempStream = new MemoryStream(workbookContent))
{
var asposeDocument = new Workbook(tempStream);
var saveOptions = new OoxmlSaveOptions(SaveFormat.Xlsx) { RefreshChartCache = refreshChartCache };
asposeDocument.Save(conversionStream, saveOptions);
}
return conversionStream.ToArray();
}
}
Then check the XML difference between the resulted files: in resultForRefreshChartCacheFalse.xlsx we have “c:numCache” while in resultForRefreshChartCacheTrue.xlsx we have “c:strCache” (please see attached XmlIssue.jpg), this seems to make the difference when we use the resulted XLSX files to export to DOCX using OpenXML the chart is generated okay (for “c:numCache”) or wrong (for “c:strCache”).
For reference I’m attaching the resulted DOCX files containing the chart exported using RefreshChartCache set to false and to true (please see attached ExportedWithoutRefreshChartCache.docx and ExportedWithRefreshChartCache.docx).
Actually if we edit the XML in resultForRefreshChartCacheTrue.xlsx and change “c:strCache” to “c:numCache” for a single bubble that respective bubble is positioned correctly in the chart exported to Word (please see attached XmlCorrectedForSingleBubble.jpg).
I’m sorry I can’t provide a full demo code for this one but I have to comply to some restrictions about the code, I hope you understand. Except that code please let me know what other information I can provide.
Thank you,
Aurelian Iordache
Software Developer
IBM Romania
Hi Aurelian,
Hi again,
Hi Babar,
I evaluated Aspose.Cells v.8.4.1.5 but when using RefreshChartCache=true it still generates c:strRef respectively c:strCache in the generated XML, could you please check again ? That branch is starting at line 72 in chart1.xml, I’m attaching a screenshot here.
About the corporate agreement we have - thank you for letting me know about this, especially about point 8 (“Nondisclosure”), I’ll ask again for approval to send to you a full demo project containing our scenario, I’ll keep you updated here.
Best regards,
Aurelian Iordache
Software Developer
IBM Romania
Hi Aurelian,
Hi Babar,
Thank you very much, no apologies are necessary.
We will expect the result of the analysis when it’s available, please keep us updated here.
Best regards,
Aurelian Iordache
Software Developer
IBM Romania
Hi Aurelian,
Hi,
Thanks for your using Aspose.Cells.
Please download and try the latest fix: Aspose.Cells for .NET v8.4.2.1 and let us know your feedback.
Hi Shakeel,
We tested with the fix and the chart is looking good now.
So I suppose this fix will be included in the next release.
Thank you very much
Best regards,
Aurelian Iordache
Software Developer
IBM Romania
Hi Aurelian,
The issues you have found earlier (filed as CELLSNET-43657) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.