我们不能用 C# 将 PPT 幻灯片中的形状以原始格式复制到 Word 文档吗?
我尝试将自动形状从 PPT 复制到 Word。但它复制为图片格式。我们无法在word中编辑文本或形状。如何避免这种情况?
我使用的代码没有给出预期的结果:
foreach (Microsoft.Office.Interop.PowerPoint.Shape shape in slide.Shapes)
{
if (targetDoc != null)
{
shape.Copy();
this.wordApp.ActiveWindow.Selection.Paste();
}
}
I tried to copy autoshape from PPT to word. but its copying as picture format. We cant edit the text or shape in word. How to avoid this?
Code I m using not giving expected esult:
foreach (Microsoft.Office.Interop.PowerPoint.Shape shape in slide.Shapes)
{
if (targetDoc != null)
{
shape.Copy();
this.wordApp.ActiveWindow.Selection.Paste();
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
某种程度上我设法以 EMF 格式复制形状。
somewhat i manged to copy shape in EMF format.
这可能是 Office.Interop 库中的默认设置,无法更改。
This may be a default thing in the Office.Interop library which cannot be changed.
显然,Copy 不是正确的 API
CopySepcial 可能正是您所需要的(尽管您必须自己查看文档)
我建议在插入单个简单形状时在 Word 中录制宏。检查宏中生成的代码并镜像该,以将形状构建为目标文档中的形状。
Obviously, Copy is not the right API
CopySepcial might be what you need (though you'll have to look at docs yourself)
I suggest recording a macro in Word, while you insert a single simple shape. Inspect the code generated in the macro and mirror that for building up the shapes as shapes in the target document.