如何替换 PowerPoint (.ppt) 文档中的文本?

发布于 2024-07-26 00:38:22 字数 187 浏览 6 评论 0原文

有哪些解决方案? 我只知道用 Apache POI 替换 Word (.doc) 文件中的书签的解决方案?

是否还可以更改 .doc 和 .ppt 文档中的图像、布局、文本样式?

我考虑替换 Word 和 PowerPoint 文档中的区域以进​​行批量处理。

平台:MS-Office 2003

What solutions are there? I know only solutions for replacing Bookmarks in Word (.doc) files with Apache POI?

Are there also possibilities to change images, layouts, text-styles in .doc and .ppt documents?

I think about replacement of areas in Word and PowerPoint documents for bulk processing.

Platform: MS-Office 2003

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

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

发布评论

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

评论(6

夏见 2024-08-02 00:38:22

您的平台有哪些限制?

显然 Apache POI 至少可以帮助您完成部分任务。

Microsoft 自己的 COM API 相当强大,并在此处进行了记录。 如果 a)您没有在服务器(许多用户,多线程)环境中运行; b) 您可以在生产机器上安装适当版本的 powerpoint; c) 您可以针对 COM 对象模型进行编码。

What are your platform limitations?

Obviously Apache POI will get you at least part of the way there.

Microsoft's own COM API's are fairly powerful and are documented here. I would recommend using them if a) you are not running in a server (many users, multithreaded) environment; b) you can have a proper version of powerpoint installed on the production machine; and c) you can code against a COM object model.

不弃不离 2024-08-02 00:38:22

它有点贵,但是 Aspose.Slides 是一个非常强大的用于操作 PowerPoint 文件的库

It's a bit pricey, but Aspose.Slides is a very powerful library for manipulating PowerPoint files

青瓷清茶倾城歌 2024-08-02 00:38:22

如果您选择使用其他 Office 套件,则以下是可能的解决方案列表:

使用 POI,您无法编辑 .pptx 文件格式,但您不依赖于系统上安装的应用程序。 相反,其他两个选项使用其他应用程序,但它们肯定更适合处理演示文稿。 顺便说一句,OpenOffice 与旧格式具有更好的兼容性。 另外,如果您使用 UNO,您将有多种语言选择,UNO 适用于 Java、C++、Python 和其他语言。

If you include using other Office suits as an option, here's a list of possible solutions:

Using POI you can't edit .pptx file format, but you don't depend on the apps installed on the system. Other two options, on the contrary, make use of other apps, but they are definitely better for dealing with presentations. OpenOffice has better compability with older formats, by the way. Also if you use UNO, you'll have a great choice of languages, UNO exists for Java, C++, Python and other languages.

悲欢浪云 2024-08-02 00:38:22

我的经验并不是直接使用 Power Point,但我实际上已经推出了自己的 WordML (XML) 生成器。 它 a) 消除了对 Word 的所有依赖,b) 速度非常快,c) 让我从头开始构建文档。

但创造起来需要做很多工作。 我只是创建一个只写实现。

我对 Power Point 不太熟悉,所以这是推测,但您可以通过阅读 XML(Power Point 2003?)和/或破解 Office Open XML 文件(压缩的 XML)来推出自己的推测,然后使用XPath 来操作数据,然后将所有内容保存回磁盘。

但这不适用于基于旧版 OLE 复合文档的 Power Point 文件。

My experience is not directly with Power Point, but I've actually rolled my own WordML (XML) generator. It a) removed all dependencies on Word, b) was very fast c) and let me build up documents from scratch.

But it was a lot of work to create. And I was only creating a write only implementation.

I'm not as familiar with Power Point, so this is conjecture, but you may be able to roll your own by reading XML (Power Point 2003??) and/or cracking the Office Open XML file (zipped XML), then using XPath to manipulate the data, and then saving everything back to disk.

This won't work on older OLE Compound Document based Power Point files though.

请持续率性 2024-08-02 00:38:22

我以前做过类似的事情:以编程方式访问和操作 PowerPoint 演示文稿。 当我这样做时,一切都是使用 COM 的 C++ 语言,但类似的原则也适用于 C#/VB .NET 应用程序,因为它们非常容易进行 COM 互操作。

您正在寻找的称为 Office 文档模型。 基本上,Office 应用程序以编程方式公开其文档,作为定义其内容的对象树。 这些对象可通过 API 访问,您可以操作它们、添加新对象以及执行您想要的任何其他处理。 它的威力极其强大; 您可以使用它来操作文档的几乎所有方面。 但您需要安装 Office 和 Visual Studio 才能使用它。

一些链接:

希望这有帮助!

I've done something like that before: programmatically accessed and manipulated PowerPoint presentations. Back when I did it, it was all in C++ using COM, but similar principles apply to C#/VB .NET apps, since they do COM interop very easily.

What you're looking for is called the Office Document Model. Basically, Office applications expose their documents programmatically, as trees of objects that define their contents. These objects are accessible via an API, and you can manipulate them, add new ones, and do whatever other processing you want. It's exceedingly powerful; you can use it to manipulate pretty much all aspects of a document. But you'll need an installation of Office and Visual Studio to be able to use it.

Some links:

Hope this helps!

2024-08-02 00:38:22

显然,新用户每次发帖只能包含一个链接。 多么蹩脚啊! :)

这是我打算包含的另一个链接:

Apparently new users can only include one link per posting. How lame! :)

Here's the other link I meant to include:

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