C# 和 Powerpoint 集成:定义颜色的问题
我使用 Microsoft.Office.Interop.PowerPoint
从 C# 应用程序生成 powerpoint 文件。
我使用的是 Office 2007 SP2。
我生成图表,我想用这样的东西定义我的系列的颜色:
serie.Border.Color = Color.Red.ToArgb();
并且我用不同的颜色来做这个。
我的问题是,生成幻灯片时,颜色不一样:当我用红色定义系列时,它用蓝色绘制,而蓝色用红色渲染。 (绿色保持绿色)。
当我想将颜色发送到 powerpoint 时,不是要使用 ToArgb()
方法吗?
我是否必须使用颜色类型的其他方法,或者是否需要进行手动转换?
I use Microsoft.Office.Interop.PowerPoint
to generate powerpoint files from a C# application.
I'm on Office 2007 SP2.
I generate charts, and I want to defines the colors of my series with something like this:
serie.Border.Color = Color.Red.ToArgb();
and I do this with different colors.
My problem is that when the slides are generated, the colors are not the same : when I define a serie in Red, it is drawn in Blue, and the Blue is rendered in Red. (The green stays green).
Isn't the ToArgb()
the method to use when I want to send a color to powerpoint?
Do I have to use an other method from the Color type, or is there a manual conversion to do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
几年前我也遇到过同样的问题。这确实很奇怪,我找不到任何有关它的文档,但基本上,红色和蓝色是混合的。
当时,我写了这些方法:
像这样使用它:
I came across the same problem a few years ago. It really is strange and I couldn't find any documentation about it, but basically, red and blue are mixed.
Back then, I wrote these methods:
Use it like this:
我遇到了同样的问题并找到了一个可行的解决方案。我已在此链接中发布了答案,如果有人仍然遇到问题,这可能会有所帮助。
https://stackoverflow.com/a/18794046/2752556
I ran into the same issue and figured out a working solution. I have posted the answer in this link, that might be helpful if anyone is still having trouble.
https://stackoverflow.com/a/18794046/2752556