Create & Insert Graphs?

hi Guys,

How do i create and insert native word charts in documents with Aspose.Words? i can’t find it in the documentation.



Thanks for your request. As I know Word format has no native charts. As a rule charts are inserted into the word document as embedded OLE objects. Unfortunately Aspose.Words doesn’t allow inserting of OLE objects.
I think that you can use Aspose.Chart component to create graph and then insert it into the word document. For example see the following code:

// Create a sample chart.
Aspose.Chart.Chart lineChart = new Aspose.Chart.Chart();
lineChart.Height = 300;
lineChart.Width = 400;
Aspose.Chart.Series lineSeries = new Aspose.Chart.Series();
lineSeries.ChartType = Aspose.Chart.ChartType.Line;
lineSeries.Name = "Series";
lineSeries.DataPoints.Add(new Aspose.Chart.DataPoint(1, 1));
lineSeries.DataPoints.Add(new Aspose.Chart.DataPoint(2, 2));
lineSeries.DataPoints.Add(new Aspose.Chart.DataPoint(3, 3));
// Fill a series manually
// Save chatr in EMF format
MemoryStream ms = new MemoryStream();
lineChart.Save(ms, ImageFormat.Emf);
// Create new document
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert chart using GetChartImage method
// Insert chart as EMF
// Save document

You can read about Aspose.Chart component here:
I hope this could help you.
Best regards.


thanks. with word 2007 you can insert graphs and double click them to make changes to their plots or change the chart type etc. it when graphs are inserted into the older .doc files.

i’m suspecting word 2007 has a emf format its using for this. can this be done with Aspose.Chart?



EDIT: i’ll give it a try after the weekend

Exactly this I meant. These charts are not native Word charts but these are embedded OLE objects.
As you can see from my code example chart created by Aspose.Chart was inserted into the Word document in EMF format.
Best regards.


thanks for the info
- what is the format of native word graphs/charts? is it emf ? ( just making sure )

  • is it possible to insert an image from a bitmap object? (just a minor question i guess)

sorry for all the questions. i’m kinda new to this


Thanks for your request. The native Word chart is Microsoft Graph Chart. You can double click this chart to edit it.
EMF is just metafiles (vector images).
Best regards.

ok i understand. thanks