Thank you for your feedback. It appears that MS Word has certain limitations and does not support these advanced charts. Kindly take your time to review it at your convenience, and please do not hesitate to reach out to us if you have any further questions or comments.
@Adhirath
We compared the charts in the docx files generated by Aspose.Cells and MS Words.
Aspose.Words will not parse charts since office 2016 if chart drawing node is under mc:AlternateContent node in the document.xml file
We will add it soon.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-59071
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@Adhirath
We have fixed this issue, please check the attached files:
OOXML.docx (22.1 KB)
dest.docx (19.0 KB)
which are generated inner hotfix with the following codes:
var workbook = new Workbook(dir + "BoxAndWhisker.xlsx");
var saveOptions = new DocxSaveOptions();
//saveOptions.AsFlatOpc = true;
saveOptions.SaveAsEditableShapes = true;
//saveOptions.SaveElementType = SaveElementType.Chart;
workbook.Save(dir + "dest.docx", saveOptions);
// ms.Position = 0;
var sourceDoc = new Aspose.Words.Document(dir + "dest.docx");
// Find the first chart shape in the document
var chartShape = sourceDoc.GetChildNodes(NodeType.Shape, true)
.OfType<Aspose.Words.Drawing.Shape>()
.FirstOrDefault(s => s.HasChart);
if (chartShape == null)
throw new InvalidOperationException("No chart found in the document.");
// Create a new document and import the chart
var newDoc = new Aspose.Words.Document();
var builder = new Aspose.Words.DocumentBuilder(newDoc);
NodeImporter importer = new NodeImporter(sourceDoc, newDoc, ImportFormatMode.KeepSourceFormatting);
Node importedChart = importer.ImportNode(chartShape, true);
builder.InsertNode(importedChart);
using (var memoryStream = new MemoryStream())
{
newDoc.Save(dir + "OOXML.docx", new Aspose.Words.Saving.OoxmlSaveOptions(Aspose.Words.SaveFormat.Docx));
}
BTW , Aspose.Cells can directly export Excel chart to Word FlatOpc with simply Workbook.Save() method, why do you still export to docx ,then export chart to flatopc? Is there any node which does not comply with the specifications of ooxml.
This was our old approach, just wanted to show that the chart was showing up empty. But even when we tried using the flatOpc approach I could not find the chart info. Were you recommending some other solution?
Also thanks again guys!
If I use the Paid support is it possible to get this hotfix early?
We will evaluate and get back to you soon.
Yes, generally, we provide fixes in the paid support desk.
@Adhirath
Please confirm whether the file https://forum.aspose.com/uploads/default/111853 can work fine.
If yes and Paid support is used, we will provide this hotfix in this week.
Sure, can you please also check for these chart types-
Box and Whisker, Histogram, Pareto, Treemap, map .
and will I be able to get the correct OOXML for the same if I use this code-
saveOptions.AsFlatOpc = true;
saveOptions.SaveAsEditableShapes = true;
saveOptions.SaveElementType = SaveElementType.Chart;
workbook.Save(dir + “dest.docx”, saveOptions);
If this is working fine I’ll reach out using the paid support. Thanks!
@Adhirath
Please refer to the sample code and check result files. result.zip (57.0 KB)
Workbook workbook = new Workbook(filePath + "sample.xlsx");
DocxSaveOptions saveOptions = new DocxSaveOptions();
saveOptions.AsFlatOpc = true;
saveOptions.SaveAsEditableShapes = true;
saveOptions.SaveElementType = SaveElementType.Chart;
workbook.Save(filePath + "dest.xml", saveOptions);
workbook.Save(filePath + "dest.docx");
This works. We’ll reach out to you guys on Paid support. Thanks!
Is it fine if I ask for this hotfix using the ticket number you provided?