Convert Office Documents without Office [closed]

帅比萌擦擦* 提交于 2019-12-07 06:22:42

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/2765872/convert-office-documents-without-office

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!