Powerpoint修改图表图例宽度

时间:2013-02-17 11:35:37

标签: vb.net excel interop powerpoint

我正在使用VB.net在Powerpoint中创建图表并遇到一个小问题:客户希望图例比原始设计更大。 Interop可以实现吗?

我基本上有这样的结构:

Dim TargetChartas Microsoft.Office.Interop.PowerPoint.Chart
TargetChart.HasLegend=true

With TargetChart.Legend
                .Position = Microsoft.Office.Interop.PowerPoint.XlLegendPosition.xlLegendPositionTop
                .Format.TextFrame2.TextRange.Font.Bold = Microsoft.Office.Core.MsoTriState.msoCTrue
                .Format.Line.Visible = Microsoft.Office.Core.MsoTriState.msoCTrue
End Width

但我无法找到宽度属性 - 就像任何正常形状一样。

你有什么想法怎么做?

我添加了excel标签,因为图表基本上是excel图表。

Argh:我需要更多的茶。我刚刚意识到Office 2010具有宽度属性,而2007年则没有。所以我只需要查看powerpoint版本......哦,快乐......

1 个答案:

答案 0 :(得分:0)

Powerpoint 2010及更高版本具有width属性,因此可以在那里工作。宽度和左侧属性有点奇怪,它们似乎与图表相关。所以期待一些实验。

如果必须支持Office 2007,可以检查应用程序版本:Chart.application.version 14.0是Office 2010.我将其转换为数字并检查它是否大于14。