简体   繁体   中英

interop word c# set chart height / width

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))"}

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM