【发布时间】:2012-12-28 13:33:15
【问题描述】:
我需要将 PowerPoint 中选择的形状导出为具有真实形状大小的 png 图像。我使用此代码进行导出:
var args = new object[] { filePath, Microsoft.Office.Interop.PowerPoint.PpShapeFormat.ppShapeFormatPNG, 0, 0, Microsoft.Office.Interop.PowerPoint.PpExportMode.ppRelativeToSlide };
objectShape.GetType().InvokeMember("Export", System.Reflection.BindingFlags.InvokeMethod, null, objectShape, args); // Export to file on disk
在磁盘上,我的图像比例和高度/宽度不正确。我尝试了 PpExportMode 枚举参数的不同值,以防万一我将 PP 中的缩放更改为 100%。但我没有正确的结果。对于基于矩形的形状,它可以正常工作。但例如对于星形或标注形状,实际尺寸不等于形状的高度/宽度属性。这是因为形状底部的小舌头。
有人知道如何正确导出这些形状吗?
【问题讨论】:
-
你在哪里找到这个时髦的方法:
objectShape.GetType().InvokeMember("Export",? documentation 表示使用Shape.Export(PathName, Filter, ScaleWidth, ScaleHeight, ExportMode) -
我已经编辑了你的标题。请参阅“Should questions include “tags” in their titles?”,其中的共识是“不,他们不应该”。
-
Jeremy - 我的 Microsoft.Office.Interop.PowerPoint.Shape 没有导出方法。所以我找到了这篇文章link
-
约翰 - 感谢您的指正。
标签: c# vsto powerpoint