C#-Excel 2013如何更改图表样式 [英] C# - Excel 2013 how to change chart style

查看:109
本文介绍了C#-Excel 2013如何更改图表样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改excel 2013中图表的样式,但它只会更改颜色:

I'm trying to chnage style for a chart in excel 2013 but it only changes color:

Range chartRange;
ChartObjects wsCharts = (ChartObjects)workSheet.ChartObjects(Type.Missing);
ChartObject myChart = (ChartObject)wsCharts.Add(0, 0, 900, 500);
Chart workChart = myChart.Chart;

chartRange = workSheet.get_Range("A1", "D12");
workChart.SetSourceData(chartRange, Type.Missing);
workChart.ChartType = XlChartType.xlColumnClustered;

现在图表如下所示:

now the chart looks like this:

,然后workChart.ChartStyle = 8;将条形的颜色更改为:

and then workChart.ChartStyle = 8; changes the bar's color to:

代替图表的样式:

我还尝试使用ChartWizard方法和Chart的其他属性,但到目前为止还没有运气.

I also tried playing with the ChartWizard method and other properties of Chart but with no luck so far.

推荐答案

尝试

workChart.ChartStyle = 209;

这篇关于C#-Excel 2013如何更改图表样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆