interop word c# set chart height / width

0

I'm currently working on building a report in c# and then outputting it to word.

I've got the chart building and being populated by data however one thing I cant get my head around is how to set the chart size / height.

any help would be appreciated, spent hours on this seemingly simple task.

CODE:

Chart CashflowChart = _document.InlineShapes.AddChart(XlChartType.xlColumnClustered).Chart;

CashflowChart.ChartArea.Height = 100;

This results in the following error :

{"Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL))"}
c#
office-interop
asked on Stack Overflow May 29, 2018 by darren • edited May 29, 2018 by Ryan

1 Answer

1

After hours of messing around and contrary to what msdn docs says you cant edit the chartarea directly, you can edit the chartobject which is the parent of the chartarea :

CashflowChart.Parent.width= 550; CashflowChart.Parent.height = 150;

answered on Stack Overflow May 29, 2018 by darren

User contributions licensed under CC BY-SA 3.0