PPT幻灯片转图片

发布于 2024-09-04 08:23:11 字数 199 浏览 5 评论 0原文

我正在使用 Office 07 PIA 将 ppt 转换为 C# 中的图像。

幻灯片已正确转换为图像。

现在,虽然单个幻灯片被转换为图像,但我希望有一种解决方法,也可以转换幻灯片内的动画。我想在我的自定义应用程序中播放这些 ppt [转换为图像],而不是在 MS PowerPoint 中。

我真的很感激任何帮助!

谢谢

I am using Office 07 PIA to convert the ppt into images in C#.

The slides are properly converted into images.

Now, while individual slides are converted into images, I was hoping for a workaround that could also convert the animations within slides too. I want to play these ppt [converted to images] in my custom application and not in MS PowerPoint.

I would really appreciate any help!

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情丝乱 2024-09-11 08:23:11

非常简单:

Office 2002

using Microsoft.Office.Core;
using PowerPoint;

ApplicationClass pptApplication = new ApplicationClass();

Presentation pptPresentation = pptApplication.Presentations.Open("myfile.ppt", MsoTriState.msoFalse,
MsoTriState.msoFalse, MsoTriState.msoFalse);

pptPresentation.Slides.Item(1).Export("slide.jpg", "jpg", 320, 240);

Office 2003

using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;

ApplicationClass pptApplication = new ApplicationClass();
Presentation pptPresentation = pptApplication.Presentations.Open("myfile.ppt", MsoTriState.msoFalse,
MsoTriState.msoFalse, MsoTriState.msoFalse);

pptPresentation.Slides.Item[1].Export("slide.jpg", "jpg", 320, 240);

图像输出质量

pptPresentation.Slides.Item[1].Export("slide.png", "PNG", 1024, 768);

It's pretty simple:

Office 2002

using Microsoft.Office.Core;
using PowerPoint;

ApplicationClass pptApplication = new ApplicationClass();

Presentation pptPresentation = pptApplication.Presentations.Open("myfile.ppt", MsoTriState.msoFalse,
MsoTriState.msoFalse, MsoTriState.msoFalse);

pptPresentation.Slides.Item(1).Export("slide.jpg", "jpg", 320, 240);

Office 2003

using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;

ApplicationClass pptApplication = new ApplicationClass();
Presentation pptPresentation = pptApplication.Presentations.Open("myfile.ppt", MsoTriState.msoFalse,
MsoTriState.msoFalse, MsoTriState.msoFalse);

pptPresentation.Slides.Item[1].Export("slide.jpg", "jpg", 320, 240);

Image Output Quality

pptPresentation.Slides.Item[1].Export("slide.png", "PNG", 1024, 768);
ゞ记忆︶ㄣ 2024-09-11 08:23:11

这个问题很难理解。

但是据我所知,你是
尝试在以下位置显示 PowerPoint 幻灯片
您的自定义 C# 应用程序?

解决方案 1:

将每个 PPT 幻灯片转换为 HTML 格式(这应该可以从 PowerPoint 中实现,例如另存为)。

将 Web 浏览器组件拖放到您的应用程序中,然后只需指向 HTML 文件即可。您甚至可以使用“下一张”abd“上一张”按钮转到下一张“幻灯片”或将其绑定到鼠标单击。

至于视频,我不确定从 PowerPoint 导出 HTML 如何处理这个问题,您也许可以将视频转换为 FLV,并将基本的 FLV flash 播放器嵌入到 HTML“幻灯片”文件中

扩展解决方案 1:

要处理动画(PowerPoint 淡入淡出等),您可以使用此免费产品 iSpring。这会将 PPT 转换为 Flash(我相信包括动画和视频)。然后可以将其嵌入到 HTML 文件中并在 Web 浏览器组件上播放。

编辑 2: iSpring 不再免费

The question is difficult to understand.

However from what I gather you are
trying to display PowerPoint Slides in
your custom C# Application?

Solution 1:

Convert each PPT slide into HTML format (this should be possible from PowerPoint e.g. save as).

Drop a web-Browser component onto your application, and then simply point to the HTML file(s). You could even get the 'next' abd 'prev' buttons to go to the next 'slide' or bind it to mouse click.

As for videos, I'm not sure how exporting HTML from PowerPoint would handle this, you may be able to convert the Video to FLV, and imbed a basic FLV flash player into the HTML 'slide' file(s)

Extended Solution 1:

To deal with the animations (PowerPoint Fades etc) you could use this free product iSpring. This converts PPT to Flash (including animations and videos I believe). Which can then be embedded into a HTML file and played back on a web browser Component.

Edit 2: iSpring is no longer free

緦唸λ蓇 2024-09-11 08:23:11

为此设置此属性

您需要在项目引用下的解决方案资源管理器中 - 右键单击​​包 - Interop。
- 单击属性。
-并且应该有嵌入互操作程序集的选项。
-将其设置为False

代码-

FileInfo objfile = new FileInfo(FileUpload1.PostedFile.FileName);
if (objfile.Extension.Equals(".pptx"))
{
    ApplicationClass pptApplication = new ApplicationClass();
    Presentation pptPresentation = pptApplication.Presentations.Open(objfile.FullName, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
    pptPresentation.Export(objfile.FullName, "jpg", Int32.Parse(pptPresentation.SlideMaster.Width.ToString()), Int32.Parse(pptPresentation.SlideMaster.Height.ToString()));
}

you need to set this properties for this

-Right click package- Interop, in the solution explorer under your project References.
-Click properties.
-And there should be the option there for Embed Interop Assembly.
-Set it to False

Code-

FileInfo objfile = new FileInfo(FileUpload1.PostedFile.FileName);
if (objfile.Extension.Equals(".pptx"))
{
    ApplicationClass pptApplication = new ApplicationClass();
    Presentation pptPresentation = pptApplication.Presentations.Open(objfile.FullName, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
    pptPresentation.Export(objfile.FullName, "jpg", Int32.Parse(pptPresentation.SlideMaster.Width.ToString()), Int32.Parse(pptPresentation.SlideMaster.Height.ToString()));
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文