AutoShape.Adjustments 对象 - 2003 与 2010 或 VBA 与 VSTO?
我正在将一些 PowerPoint VBA 宏移植到 VSTO 插件内的 C# 中,以自动执行某些任务。
这些宏是为 PP 2003 编写的,我正在以 PP 2010 作为目标编写 VSTO 附加组件。这些宏通过 AutoShape.Adjustments 对象大量使用 AutoShape 操作。
在 2003 年下的 VBA 中,我将访问带线图例自动形状的“线目标”的 X 轴位置,如下所示:
shape.Adjustments.Item(1) = someFloat
在 c#/VSTO 中,这似乎已更改为
shape.Adjustments[6] = someFloat;
There is now .Item collection in c#/VSTO 。
有谁知道这些值记录在哪里,最重要的是,2010 年记录在哪里?
或者这都是切换到VSTO造成的?如果是这样,他们为什么会选择让您使用不同的索引号?
现在,我只能手动测试 C# 中的每个调整索引,直到找到与 VBA 中的目标相对应的索引。
I am porting some PowerPoint VBA macros into C# inside a VSTO add-on which automate certain tasks.
The macros were written for PP 2003 and I'm writing the VSTO add-on with PP 2010 as a target. The macros make heavy use of AutoShape-manipulation through the AutoShape.Adjustments object.
In VBA under 2003 i would access the X-Axis position of the "line-target" of a Legend-with-Line autoshape like this:
shape.Adjustments.Item(1) = someFloat
In c#/VSTO this seems to have changed to
shape.Adjustments[6] = someFloat;
There is now .Item collection in c#/VSTO.
Does anyone know where these values are documented, and most importantly, where they are documented for 2010?
Or is this all caused by switching to VSTO? If so, why would they choose to have you use different index numbers?
For now i'm stuck to manually test every Adjustments index in C# one after the other until i find the one that corresponds to the target in VBA.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我从未遇到过任何文档来解释各种调整的作用以及它们适用于哪些形状。
至于索引/语法的差异,一个疯狂的猜测:
在VBA中,Shape.Adjustments.Item(x)和Shape.Adjustments(x)是等价的;调整的默认属性(与大多数集合一样)是 .Item,因此并不严格需要显式使用它。
也许在 .NET 中,您可以对所有调整属性进行索引,因为(据我所知)不再有默认/隐式属性。换句话说,也许您看到的是所有形状都一致的偏移。
I've never run across any documentation that explains what the various adjustments do and which shapes they apply to.
As to the difference in indexing/syntax, a wild guess:
In VBA, Shape.Adjustments.Item(x) and Shape.Adjustments(x) are equivalent; the default property for Adjustments (as with most collections) is .Item, so it's not strictly necessary to explicitly use it.
Perhaps in .NET, you index into all of the Adjustments properties, since (as I understand it) there's no longer a default/implicit property. In other words, perhaps what you're seeing is an offset that will be consistent for all shapes.