开发者

Changing Color of Individual Bars in Microsoft.Interop.Graph.Chart .NET?

Can anyone help me out how I can change the individual color of each series bar using Microsoft Graph PIA in C#?

I have tried multiple ways but nothing w开发者_如何学JAVAorks. There is this ChartFormatFill object inside the Series object but it is read only and doesnt allow me to change the color of the bars.

I have also tried recording a macro and then reading its code but for some weird reason the change color instruction doesnt get macroed. There is no code corresponding to it.

Its the same issue with all the charts. I can't programmatically format the chart series.

I am major stuck here. Can anyone help me out?

Thanks

Regards, Muneeb


Pleas try:

using Graph = Microsoft.Office.Interop.Graph;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;

[...]

PowerPoint.Application oPowerPoint = new PowerPoint.Application();

[...]

PowerPoint.ShapeoShape oShape = oPowerPoint.ActiveWindow.Selection.ShapeRange[1];

[...]

Graph.Chart oChart = (Graph.Chart)oShape.OLEFormat.Object;

[...]

Graph.Series serie = (Graph.Series)oChart.SeriesCollection(1);
Graph.Point point = (Graph.Point)serie.Points(1);                 // !!!!!!!!!!
point.Interior.Color = 0x808080;
point = (Graph.Point)serie.Points(2);
point.Interior.Color = 0x800080;

--
peace

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜