从模板创建 PowerPoint 2007 演示文稿

发布于 2024-07-16 08:38:03 字数 593 浏览 2 评论 0原文

我需要使用 开放 XML 格式 SDK 2.0。 该模板必须由客户提供,并用于单独的布局样式(字体、背景颜色或图像……)。 它需要包含两个预定义的幻灯片:

  • 文本幻灯片
  • 图像幻灯片

应用程序现在应该创建模板文件的副本,创建文本和图像幻灯片的多个副本,并用一些内容替换内容占位符。

我已经找到了一些来自 Microsoft 的代码片段 编辑幻灯片标题、删除幻灯片或替换幻灯片上的图像。 但我不知道如何创建现有幻灯片的副本。 也许有人可以帮助我解决这个问题。

I need to create a PowerPoint 2007 presentation from a template with Open XML Format SDK 2.0. The template has to be provided by the customer and is used for a individual layout style (font, background color or image,...). It needs to contain two predefined slides:

  • Text slide
  • Image slide

The application should now create a copy of the template file, create multiple copies of the text- and image slides and replace the content-placeholders with some content.

I already found some code snippets from Microsoft to edit the title of a slide, delete them or replace a image on a slide. But i didn't find out how i can create a copy of a existing slide. Maybe somebody can help me with this.

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

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

发布评论

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

评论(3

终遇你 2024-07-23 08:38:03

我一直在寻找类似的答案,并找到了一些可以分享的资源:

http://msdn.microsoft.com/en-us/library/cc850834(office.14).aspx

或更多示例

http://msdn.microsoft.com/ en-us/library/cc850828(office.14).aspx

或此网站

http://www.openxmldeveloper.com

还有这个 记录 OpenXML 标准的免费书籍 这有点帮助。

I have been looking around for a similar answer and have found some resources to share:

http://msdn.microsoft.com/en-us/library/cc850834(office.14).aspx

or more samples

http://msdn.microsoft.com/en-us/library/cc850828(office.14).aspx

or this website

http://www.openxmldeveloper.com

There is also this free book documenting the OpenXML standard which was somewhat helpful.

も星光 2024-07-23 08:38:03

这是我认为您正在寻找的内容的示例,但如果没有,请告诉我:http: //openxmldeveloper.org/articles/7429.aspx

This is an example of what I thing you're looking for, but if not, let me know: http://openxmldeveloper.org/articles/7429.aspx

一笑百媚生 2024-07-23 08:38:03

对于 C#,

File.Copy(SourceFile,ExportedFile);

您基本上保留原始文件。

现在您打开 ExportedFile

PowerPoint.Application ppApp = new PowerPoint.Application();
PowerPoint.Presentation presentation;
presentation = ppApp.Presentations.Open(ExportedFile, MsoTriState.msoFalse,   MsoTriState.msoTrue, MsoTriState.msoTrue);

现在迭代所有幻灯片/形状

foreach (PowerPoint.Slide slide in presentation.Slides)
{
                    slide.Select();
                    foreach (PowerPoint.Shape shape in slide.Shapes)
                    {
                        if (shape.Type.ToString().Equals("<any type of shape>"))
                        {
                            if (shape.TextFrame.TextRange.Text.Equals("<contains a name"))
                            {
                                shape.TextFrame.TextRange.Text = <new value>;
                                shape.Delete(); // or delete
                                shape.AddPicture(<your new picture>, MsoTriState.msoTrue, MsoTriState.msoTrue, left, top, width, height);

                            }
                        }
                    }

}

希望这可以澄清您的请求。

For C#

File.Copy(SourceFile,ExportedFile);

You basically keep the original file.

Now you open ExportedFile

PowerPoint.Application ppApp = new PowerPoint.Application();
PowerPoint.Presentation presentation;
presentation = ppApp.Presentations.Open(ExportedFile, MsoTriState.msoFalse,   MsoTriState.msoTrue, MsoTriState.msoTrue);

Now iterate all slides/shapes

foreach (PowerPoint.Slide slide in presentation.Slides)
{
                    slide.Select();
                    foreach (PowerPoint.Shape shape in slide.Shapes)
                    {
                        if (shape.Type.ToString().Equals("<any type of shape>"))
                        {
                            if (shape.TextFrame.TextRange.Text.Equals("<contains a name"))
                            {
                                shape.TextFrame.TextRange.Text = <new value>;
                                shape.Delete(); // or delete
                                shape.AddPicture(<your new picture>, MsoTriState.msoTrue, MsoTriState.msoTrue, left, top, width, height);

                            }
                        }
                    }

}

Hope this might clarify your request.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文