How to create a chart using Open XML SDK in Word 2010
Creating a Chart in Open involves two steps, as the data is stored at two locations. Chart Cache Embedded Package - This is nothing but an Excel Sheet Thus, populating the data in Cache is not enough. We should also create corresponding Excel Sheet. Below is the sample code. The code is verbose as I was using Open XML productivity tool to arrive at this. Full source code can be found at https://github.com/pradeepkumargali/GenerateWord-OpenXML Main Class: ChartPart chartPart2 = mainDocumentPart1.AddNewPart<ChartPart>("rId7"); GenerateChartPart2Content(chartPart2); //Used to generate a dummy excel sheet out of a predefined blob - Look at "private string embeddedPackagePart2Data" EmbeddedPackagePart embeddedPackagePart2 = chartPart2.AddNewPart<EmbeddedPackagePart>("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "rId1"); GenerateEmbeddedPackagePart2Content(embe...