I can already populate the data into the spreadsheet, create the chart based on the range I select. However, when it comes to formatting the actual chart I feel a bit lost as their are so many options!!
我已经可以将数据填充到电子表格中,根据我选择的范围创建图表。然而,当谈到格式化实际图表时,我觉得有点迷失,因为他们有这么多的选择!
It is an xlCylinderBarStacked type chart. I simply need to make the color of the bars a nice light orange and make the background a light blue fading into white at the bottom.
它是一个xlCylinderBarStacked类型图表。我只需要将条纹的颜色变成一个漂亮的浅橙色,并使背景浅蓝色在底部褪色为白色。
Any idea's how to do this?
任何想法是如何做到这一点?
2 个解决方案
#1
Just to close this question off. I played around a little with the properties and the following achieved the gradient effect on the background of the chart.
只是关闭这个问题。我用属性玩了一下,下面的图表背景实现了渐变效果。
xlChart.Interior.Color = ColorTranslator.ToOle(Color.LightSkyBlue);
chart.ChartArea.Fill.TwoColorGradient(
Microsoft.Office.Core.MsoGradientStyle.msoGradientHorizontal,
1);
#2
One good trick with Excel and other VBA-enabled apps is to manually create the formatting/content you require using the Excel GUI, whist recording a 'macro'. Once this is done you can then inspect the generated VBA to see how to use the API to acheive the same results programmatically. You will of course have to do some translation from VBA to C# but essentially the same methods should work.
使用Excel和其他支持VBA的应用程序的一个好方法是使用Excel GUI手动创建所需的格式/内容,并记录“宏”。完成此操作后,您可以检查生成的VBA,以了解如何使用API以编程方式获得相同的结果。您当然必须从VBA到C#进行一些翻译,但基本上相同的方法应该有效。
#1
Just to close this question off. I played around a little with the properties and the following achieved the gradient effect on the background of the chart.
只是关闭这个问题。我用属性玩了一下,下面的图表背景实现了渐变效果。
xlChart.Interior.Color = ColorTranslator.ToOle(Color.LightSkyBlue);
chart.ChartArea.Fill.TwoColorGradient(
Microsoft.Office.Core.MsoGradientStyle.msoGradientHorizontal,
1);
#2
One good trick with Excel and other VBA-enabled apps is to manually create the formatting/content you require using the Excel GUI, whist recording a 'macro'. Once this is done you can then inspect the generated VBA to see how to use the API to acheive the same results programmatically. You will of course have to do some translation from VBA to C# but essentially the same methods should work.
使用Excel和其他支持VBA的应用程序的一个好方法是使用Excel GUI手动创建所需的格式/内容,并记录“宏”。完成此操作后,您可以检查生成的VBA,以了解如何使用API以编程方式获得相同的结果。您当然必须从VBA到C#进行一些翻译,但基本上相同的方法应该有效。