@Adhirath
Please save as docx file, then check whether file is ok.
workbook.Save(“chart.docx”, saveOptions);
workbook.Save(ms, saveOptions);
If chart.docx does not contain editable chart, please share your template file and result file. We will check them soon.
I tried this and still getting an error, not even able to save the word doc with a physical address. If I try the same without setting SaveAsEditableShapes property the code runs fine.
@Adhirath
Please try the sample project.
ConsoleApp1.zip (379.2 KB)
Hi guys any news on this. Are we able to extract ooxml of a chart by saving a xlsx as docx?
@Adhirath,
We currently support saving XLSX files in the DOCX file format, which works seamlessly. You can test this functionality using the sample project provided in our earlier response. Once saved as DOCX, you can easily convert the file to FlatOPC format using Aspose.Words or OpenXmlSdk.
Please note that there are differences between charts in Excel (XLSX) and Word files. In Aspose.Cells, charts must be saved as XLSX FlatOPC rather than Word FlatOPC. Although we support the FlatOPC format, it is not possible to directly copy the XLSX FlatOPC content into DOCX FlatOPC format.
Thank you for your understanding.
1 Like
great, one doubt though once I convert the xlsx to docx and then extract the ooxml for the chart is it possible to just extract the chart ooxml and not the table that comes with it. I want to basically just insert the chart and not the table along with it.
@Adhirath
We will check whether Words can support const values as data source of the chart soon.
@Adhirath
It’s ok that if we only store const values to chart in the docx file.
We will provide a property similar as DocxSaveOptions.EmbedXlsxAsChartDataSource:
var wbk1 = new Workbook(dir + "book1.xlsx");
DocxSaveOptions saveOptions = new DocxSaveOptions();
saveOptions.SaveAsEditableShapes = true;
saveOptions.EmbedXlsxAsChartDataSource = false;
wbk1.Save(dir + "dest.docx", saveOptions);
Please check the following docx without embedding an xlsx file .
dest.docx (13.5 KB)
@Adhirath,
Moreover, for your information, we logged a ticket (Ticket ID: “CELLSNET-58933”) as enhancement to support const values as data source of the chart in the DOCX file for your requirements.
Please note, the new enhancement will be incorporated (sample code already provided in the previous post) in the next release (Aspose.Cells v25.9), which is expected to be released in the first half of September 2025. We will notify you as soon as the new version is released.
You guys are amazing, thanks a ton!!!
So what I’m hearing is if I save the xlsx as docx and have these 2 options as true I can simply extract the chart OOXML ( the drawing part) without needing the table?
@Adhirath
Thank you for your feedback. Your understanding is correct. In the next version v25.9, Aspose.Cells will support store const values to chart in the docx file. We will notify you as soon as the new version v25.9 is released.
Quick question guys, when I see the xml of this dest.docx you shared above I see 2 tables in it and no tag which generally shows up with charts. Is it expected behavior? If it is not too much of a task can you save an excel with a pie chart to docx format and share the file. Thanks!
@Adhirath,
Do you also need the relevant tag(s) to be rendered in the output DOCX? We appreciate if you could share your expected DOCX file. This may help us to achieve your exact requirements. We will look into it soon.
@Adhirath
pie.docx (13.4 KB)
Please check the above pie chart.
@Adhirath,
Sure, please review the document containing the pie chart at your convenience and then share your feedback with us.
Reference: I’m attaching a Word document that contains a chart along with its complete OOXML structure. Please review the OOXML format in this document - this is exactly how I would like Aspose to generate chart output.
ChartWithRequiredOOXML.zip (33.7 KB)
@Adhirath,
Thank you for sharing the Word document along with the specified OOXML structure. We will thoroughly review it and provide our feedback soon.
@Adhirath
The format in the document is FlatOPC file format, so you just want to export the file as FlatOpc type not docx?
We will look into directly convert Workbook to FlatOPC soon.
And we are thinking about whether we can simply provide a method chart.toOOXML() to return chart1.xml too.
Chart.toOOXML() would be great. So I shared the markup above, I am also sharing the OOXML for the particular chart I shared.
The only difference between this and what I shared is that the above doesn’t have any actual data but this does. So this can be directly inserted into the OOXML of the current document and produce a functioning chart.
InsertedChartXMLWithBinaryData.zip (14.2 KB)