Could you kindly provide us with a standalone sample app/project along with sample files to illustrate the issue or requirements? Additionally, please share your expected OOXML format for our reference. We will check it soon.
This is the code I use. Hope that helps you understand my issue better. Please respond using the same file in case there are any changes for code privacy purposes. The Idea is I select a chart for which I have the name and then I want to save the excel doc as a word doc using FlatOPC format so I can extract it’s OOXML.
here is the code-
AsposeCode.zip (11.4 KB)
Thanks for providing further details and sample code snippet.
Apparently, Aspose.Cells does not support to render Flat OPC format directly (where represents an entire Open XML document, including images and binary parts, is stored in a single XML file). Anyways, we will evaluate and get back to you soon.
@Adhirath
We only support saving the xlsx as .docx. You can convert .docx to FlatOPC with Aspose.Words or OpenXmlSdk.
There are some difference about charts between Excel xlsx and Words file.
In Aspose.Cells , we have to save as xlsx Flat opc ,not word Flat OPC even if we support flat opc format. You still can not simply copy the part of xlsx Flat opc to docx Flat OPC .
Makes sense, although I am first saving it as Docx with SaveasEditableShapes set to true and then saving that word document as flatopc. When I call the workbook.Save() i get an instance not found error.
I don’t face this issue if I don’t have -
options.SaveAsEditableShapes = true;
@Adhirath
The DocxSaveOptions.SaveAsEditableShapes property is only supported in the latest version v25.6. Please update the Aspose.Cells to v25.6. Please check the following document.
I am on the latest version, I can save it in a memory stream right?
@Adhirath
Of course, you can save the file to a stream object. Please refer to the following sample code.
// Load your source workbook
Workbook workbook = new Workbook("sample.xlsx");
// Save the workbook to a memory stream
var stream = new MemoryStream();
DocxSaveOptions options = new DocxSaveOptions();
options.SaveAsEditableShapes = true;
workbook.Save(stream, options);
If you still have any questions, please provide us with your sample files and test code, and we will check it soon.
I am doing the same but still facing the issue,here is the code it is under generate ooxml method-
AsposeCode.zip (11.4 KB)
@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.
Hi guys any news on this. Are we able to extract ooxml of a chart by saving a xlsx as docx?
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.
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
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)
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?