Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Chart to WordprocessingML

I would like to generate an Open XML document containing a Chart using the Open Xml SDK 2. I found an SpreadsheetML example, but I can't work out how to add the chart in a .docx...

Is there a good source for documentation/examples for the Open Xml SDK 2?

like image 784
herskinduk Avatar asked Feb 14 '09 16:02

herskinduk


1 Answers

This article describes how to add a picture to WordProcessingML from an XML perspective: http://openxmldeveloper.org/articles/462.aspx

Actual code for the same thing using the Open XML API: http://msdn.microsoft.com/en-us/library/bb497430(office.14).aspx

If you've successfully added a chart to SpreadsheetML, you can adapt the picture example to do the same for WordProcessingML. You'll still have the a:graphic element that they have in their example. Contained inside, the a:graphicData will have a chart URI (http://schemas.openxmlformats.org/drawingml/2006/chart) instead of a picture URI. The data inside the a:graphicData will be identical to what you had for SpreadsheetML.

like image 193
Wayne Kao Avatar answered Nov 11 '22 00:11

Wayne Kao