使用 JavaScript 创建 OpenXML 文档
我有一个应用程序需要使用 JavaScript 创建简单的 OpenXML 文档(特别是 PowerPoint 演示文稿)。
任何人都可以建议如何开始这样做吗(或者即使可能的话)?我使用 Microsoft OpenXML SDK 使用 C# 执行类似的操作,并且想知道是否有任何具有类似功能的 JavaScript 库。
本质上,问题是如何创建构成解压缩的 PowerPoint 文档的各个 OpenXML 文档,然后将它们压缩在一起以创建 PowerPoint (.pptx) 文件,然后有人可以将其保存到磁盘上。
欢迎任何想法!
I have an application that needs to create simple OpenXML documents (in particular PowerPoint presentations) using JavaScript.
Can anyone suggest how to get started on this please (or even if it is possible)? I've used the Microsoft OpenXML SDK for doing something similar using C#, and was wondering whether there were any JavaScript libraries with similar functionality.
Essentially the problem is how to create the individual OpenXML documents that make up an unzipped PowerPoint document, then zip them together to create the PowerPoint (.pptx) file, which someone can then save to their disk.
Any ideas welcome!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用适用于 Javascript 的 OpenXML SDK
Use the OpenXML SDK for Javascript
显然,诸如压缩/解压缩文档或保存文档之类的操作无法在客户端使用纯 JavaScript 完成。
但是,如果您想做这样的事情,我相信有一些 Linux 软件包可以接受字符串作为输入,并为您提供一个随时可用的 Office 文档作为输出。
如果您不方便使用 Linux 软件包,假设您想将其保存为 word 2007 文档:
您可以在客户端构建此字符串。然后通过AJAX发送到服务器,让你的服务器处理它。具体来说,我自己多次使用这些API。让 PHP 处理它。将结果保存在某处,或强制客户端的浏览器下载它(流结果)
Obviously, operations such as Zipping/unZipping a document or saving a document cannot be done client-side and with pure javascript.
However, if you want to do such things, I do believe that there are Linux packages out there that accept strings as input and give you a ready to use Office document as output.
If you're not convenient with Linux packages, assuming you want to save this as a word 2007 document:
You can build this string, client-side. then send it to server through AJAX and let your server deal with it. specifically I have used these APIs myself multiple times. let PHP handle it. save the result somewhere, or force client's browser to download it (stream results)
使用 开放 XML SDK。
您可以在节点上运行它,并在 32 秒内创建 2000 个文档。或者您可以在浏览器上运行它。
USE OPEN XML SDK.
You can run it on node and in 32 seconds it creates 2000 documents. Or you can run it on the browser.