是否可以使用新数据更新 PowerPoint 幻灯片(在 C# 中)?
有没有关于如何更新 PowerPoint 幻灯片的示例(通过清除某个文本框中的文本并使用新内容更新它)?
我需要在 PowerPoint 中生成一份月度报告,并且所有数据都存储在数据库中。我试图确定是否可以通过使用带有三个文本框的空白 PowerPoint 模板来简单地自动生成幻灯片,并且数据将从我的 C# 代码中填充。
我要寻找的其他示例是:
- 项目符号列表
- 表格
任何正确方向的帮助将不胜感激。我在 SOF 上看到一些类似的问题,但似乎没有一个回答这个问题。
我认为最简单的方法是使用 OpenXML 格式 (.pptx),因为我在计算机上可能没有 PowerPoint 的 Web 服务器上运行。
Are there any examples out there on how to update a PowerPoint slide (by clearing the text in a certain textbox and updating it with new content)?
I have a monthly report to generate in PowerPoint and I have all the data in a database. I am trying to determine if I can simply autogenerate the slides by having a blank PowerPoint template with three textboxes and the data would get filled in from my C# code.
The other examples i would look for are:
- bulletted lists
- tables
Any help in the right direction would be appreciated. I see a few questions on SOF that are similar but none seems to answer this question.
I assume the easiest would be to use the OpenXML format (.pptx) as i am running on a web server that may not have PowerPoint on the machine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
很抱歉耽搁了很长时间,希望您仍在寻找这个。请注意,这不使用SDK - 它只使用
System.IO.Packaging
和Linq(和XML Literals)。无论如何,要做的是:添加4个文本框。
他们“样本1”,“样本2”和
“样本3”。
文本,然后制作这些线条
要点。将其命名为“ListSample1”。
这就是你所需要的。然后保存文件并记下路径,并更改下面的
filePath
变量以反映演示文稿的路径。在控制台应用程序中运行以下代码:
抱歉,我知道这对 VB 和 XML 文字来说非常重要,但 C# 应该能够通过一些转换工作来完成同样的事情。
Sorry for the really late delay, hope you're still looking for this. Note this does NOT use the SDK - it just uses
System.IO.Packaging
and Linq (and XML Literals). Anyway, here's what to do:add 4 textboxes.
them "Sample1", "Sample2" and
"Sample3".
of text and then makes those lines
bullet points. Name it "ListSample1".
That's all you need. Then save the file and note the path, and change the
filePath
variable below to reflect your presentation's path.Run the below in a Console app:
Sorry, I know this is heavily weighted towards VB and XML Literals, but C# should be able to do the same thing with some conversion work.
是的,这是可能的,这里是有关如何在线进行操作的教程。他们还在该博客中提供了该项目的示例代码,这应该会有所帮助。
Yeah this is possible and here is a tutorial on how to do it online. They also have the sample code for the project in that blog which should help.
您可能想了解一下 Office Automation API。让您以编程方式修改、创建等 powerpoint 文档。
本文档适用于较旧版本的 powerpoint,但相同的过程适用于较新版本。
http://support.microsoft.com/default.aspx?scid =kb;EN-US;303718
不过,请注意,如果您确实使用办公自动化 api,请确保您使用您在 C# 中创建的此工具支持的最低 Office 版本来构建它。
You probably want to have a look at the Office Automation API. Will let you programatically modify, create, etc powerpoint documents.
This document is for an older version of powerpoint but the same process works for newer versions.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;303718
Word of warning though, if you do use office automation api make sure you build it against the lowest version of office you want to support with this tool you are creating in c#.