无需 Office 即可转换 Office 文档

发布于 2024-08-31 18:31:26 字数 146 浏览 3 评论 0原文

我们需要将所有 MS Office 文档转换为 PDF、TIFF 或任何类似的图像格式,且格式不会丢失(这些是无法篡改的官方文档)。

有什么方法可以在不安装 Office 的情况下执行此操作吗?理想情况下,这将在服务器上运行并运行多线程,而无需办公自动化的开销。

We are in need of converting all MS Office documents to PDF, TIFF, or any similar image format with no loss in formatting (these are official documents that cannot have tampering).

Is there any way to do this without installing Office on the machine that would do this? Ideally, this would go on a server and run multi-threaded without the overhead of Office Automation.

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

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

发布评论

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

评论(2

久随 2024-09-07 18:31:26

您可以使用 Aspose.NET 等第三方库进行文档转换,但恐怕 - 如果高保真渲染至关重要 - 则无法使用原始应用程序。

Microsoft Office 提供了转换器 API,无需安装 Office 即可进行转换。但是,您不仅可能面临许可证问题 (IANAL),而且此 API 仅支持不需要渲染文档的文本处理格式的转换(例如 RTF -> DOC、DOC -> DOCX),因此它是这对你来说并不是一个真正的选择。

更新:最好的选择可能是查看 SharePoint 2010 转换引擎,它完全是为自动(服务器端)文档转换而设计的。但它相当重(硬件和价格),所以对于您的用例来说可能有点过分了。

You could use a third-party library such as Aspose.NET for document conversion, but I'm afraid - if high-fidelity rendering is critical - there is no way around using the original application.

Microsoft Office provides a converter API which allows conversions without Office being installed. However, not only might you be facing license issues (IANAL), this API only supports conversions of text-processing formats that don't require rendering the document (e.g. RTF -> DOC, DOC -> DOCX), so it is not really an option for you.

Update: Probably the best option would be to have a look at the SharePoint 2010 conversion engine, which is exactly made for automated (server-side) document conversions. It's quite heavy though (both hardware and pricing) so maybe it is overkill for your use-case.

摘星┃星的人 2024-09-07 18:31:26

如果此应用程序将在专用计算机上运行(即该计算机的唯一工作是转换大量 Office 文档),那么最安全的选择可能是以单线程方式使用 Office 自动化,并让应用程序愉快地转换一个文件一次。多线程办公自动化应用程序可能会以更快的总体速率转换文档(尤其是在多核处理器上),直到服务器崩溃。

Office Open XML 是一种非 Office 自动化替代方案,但由于我目前正在与它在导出到相对较小的 Excel 文件 (~1MB) 时产生 OutOfMemoryException 错误的倾向作斗争,因此我真的不推荐它。

If this application will be run on a dedicated machine (i.e. the machine's only job is to convert a gigantic collection of Office documents), your safest bet is probably to use Office automation in a single-threaded manner and let the app happily convert one file at a time. A multi-threaded Office Automation app would probably convert documents at a faster overall rate (especially on a multi-core processor), up to the point where the server crashes.

Office Open XML is a non-Office-Automation alternative, but since I'm currently battling its tendency to produce OutOfMemoryException errors when exporting to relatively small Excel files (~1MB), I can't really recommend it.

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