Convert excel chart to OOXML

@Adhirath
Do you only want to export a chart to flatopc?
If yes, we can copy chart to an empty workbook, then convert it to flatopc as the following :

 Workbook workbook = new Workbook(dir + "Book1.xlsx");
 Chart chart = workbook.Worksheets[0].Charts[0];
 Workbook w = new Workbook();
 w.Worksheets[0].Shapes.AddCopy(chart.ChartObject, 0, 0, 0, 0);
          
 DocxSaveOptions saveOptions = new DocxSaveOptions();
 saveOptions.AsFlatOpc = true;
 saveOptions.SaveAsEditableShapes = true;
 saveOptions.EmbedXlsxAsChartDataSource = false;

 w.Save(dir + "word_flatopc.xml", saveOptions);

word_flatopc.zip (9.0 KB)

Yes I do want only the chart to export to flapOpc, but even this flatOpc you provided has table tags. What happens because of that is when I insert this xml I get the table design and layout options along with chart design which I would like to avoid. I believe whenever the SaveAsEditableShapes is enabled the table will be present in the OOXML. So the only way I have been able to avoid that is after saving it to Docx I copy only the chart into a new doc and then save that as flatOpc. If we can replicate this great, otherwise I am absolutely fine with just having EmbedXlsxAsChartDataSource saveoption. Hope this makes sense.

@Adhirath
Thank you for your feedback. We have understood your needs. You need to directly convert the chart to flapOpc, and there are no table tags in the conversion result file.

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-58963

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.

1 Like

@Adhirath

Workbook workbook = new Workbook(dir + "Book1.xlsx");
//Chart chart = workbook.Worksheets[1].Charts[0];
//Workbook w = new Workbook();
//w.Worksheets[0].Shapes.AddCopy(chart.ChartObject, 0, 0, 0, 0);

DocxSaveOptions saveOptions = new DocxSaveOptions();
saveOptions.AsFlatOpc = true;
saveOptions.SaveAsEditableShapes = true;
//saveOptions.EmbedXlsxAsChartDataSource = false;
saveOptions.SaveElementType = SaveElementType.Chart;
workbook.Save(dir + "OnlyChart.xml", saveOptions);

Please the attached flatopc file
OnlyChart.zip (15.2 KB)

There is no <tbl> node now.

looks good. Thanks guys really appreciate the effort!

@Adhirath,

Thanks for your feedback.

This new enhancement/fix will be included in the next release (Aspose.Cells v25.9), which will be released before the end of this week of September 2025. We will notify you once the new version is available.

1 Like

Hi guys any update on when the new version will be out?

@Adhirath
We will release the new version v25.9 this week. We will notify you promptly once version v25.9 is released.

sure, any date I can look forward to? Have a dependency on this update.

@Adhirath
Thank you for your feedback. The new version v25.9 will be released before September 12, 2025.

1 Like

The issues you have found earlier (filed as CELLSNET-58945,CELLSNET-58963,CELLSNET-58933,CELLSNET-58958) have been fixed in this update. This message was posted using Bugs notification tool by leoluo

1 Like

It works guys!!! Thank you soo much for the help!

@Adhirath,

Thank you for your kind words. We glad to hear that the new version meets your needs. If you have any further questions or feedback, please don’t hesitate to reach out to us.

1 Like

Hi guys, it’s working great unfortunately I am facing issue with retrieving the WordML in case of the following charts-
Box and Whisker, Histogram, Pareto, Treemap, map .
Are these not supported or my code is at fault.

@Adhirath,

Could you please elaborate on the issue you are experiencing? Also, please zip and attach sample input Excel file(s) along with any output files (if generated). Additionally, we would appreciate it if you could share the sample code snippet you are using with Aspose.Cells APIs. We will check your issue soon.

sure, I’ll get back to you

@Adhirath
Thank you for your feedback. Please take your time to zip and attach sample excel files along with any output files (if generated). It would be helpful to provide runnable sample code and screenshots to reproduce the issue. We will check it soon.

This console app should help with understanding the issue. It is still giving me a chart but it’s content is empty. Please have a look.

Same happens for the following chart types as well-
Histogram, Pareto, Treemap, map

@Adhirath
If we directly convert xlsx to docx, BoxAndWhisker Chart works fine in docx.

  Workbook workbook = new Workbook(dir + "BoxAndWhisker.xlsx");
  var saveOptions = new DocxSaveOptions();
  //saveOptions.AsFlatOpc = true;
  saveOptions.SaveAsEditableShapes = true;
  workbook.Save(dir + "net259.4.docx", saveOptions);

net259.zip (34.3 KB)
We fixed an issue of theme color of docx file in 25.9.4

Maybe it should be issue that Aspose.Words does not support advance charts(Histogram, Pareto, Treemap, map ) since office 2016.
If you still want to use Aspose.Words to extract charts , please contact Aspose.Words team.
And is there any issue in docx flatopc file generated by Cells?

Yes, even when using AsFlatOpc true the OOXML seems to have no chart details. I tried copy/pasting as well and I get what you’re saying even word does not support pasting these charts with data. Let me look further into it.