Quantcast
Channel: Aspose.Words Product Family
Viewing all articles
Browse latest Browse all 1762

Updating chart in word document

$
0
0

Hey

I am creating a report and as part of the report we have to show few charts. I am working of a template doc and it has sample editable pie/bar charts.

I try to find the chart and then update the values with the report values. However the chart color is changed from the template doc.

The same doesn't happend when I create a pptx report . The updated charts take the color of the template file. However for ppt I could get the workbook of the chart and update the values of the excel.

For word document i couldnt get the workbook of the editable chart. Why is this so? I am trying for past few days. Any help would be great.

Thanks

public

Aspose.Words.Drawing.Charts.Chart FindChart(Document document, string chartName)

{var shapes = document.GetChildNodes(NodeType.Shape, true).ToArray();

foreach(Shape shape in shapes)

{

if(shape.HasChart)

{

if(shape.Name == chartName){

return shape.Chart ;}               

}}returnnull;}

 

//updating values of bar chart

var ch = this.FindChart(document, chartName);

var seriesCol = ch.Series;

seriesCol.Add(previousYear, ab, pv);

seriesCol.Add(currentYear, ab, cv);

I want to set the bar colors.

 

Thank you


Viewing all articles
Browse latest Browse all 1762

Latest Images

Trending Articles



Latest Images