在Linux上的Microsoft Word文档中以编程方式获取页数 [英] Programatically get pages count in Microsoft Word documents on linux

查看:147
本文介绍了在Linux上的Microsoft Word文档中以编程方式获取页数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从Word文档中获取页数.我已经测试了许多库和脚本(apache poi,perl脚本,一些针对Linux的应用程序等等),唯一可行的解​​决方案是使用Wine安装Microsoft Office并使用perl访问OLE.我已经做到了,但是由于许可问题,似乎无法在服务器上使用它.

I need to get pages count from word documents. I've tested many libraries and scripts (apache poi, perl scripts, some application for linux and some more) and the only working solution was to install Microsoft Office with Wine and access OLE with perl. I've managed to do it but it seems I can't use it on server due to licensing problems...

apachepoi和其他提供对Word文档信息的访问权的解决方案的问题与某些文档的不完整有关.文档摘要中的pageCount属性有时会丢失(对于另存为doc和较旧文档的odt文档,通常是这种情况.)

The problem with apachepoi and other solutions providing access to word documents info is related to incompleteness of some docs. pageCount property in document summary is sometimes missing (it's often case with odt documents saved as doc and older docs).

是否有任何方法可以在不在服务器上安装Microsoft Office的情况下真正计数页面(不仅从摘要中获取信息)?

Is there any way to actually count pages (not only get info from summary) without installing Microsoft Office on server?

推荐答案

我要说的是 wvSummary ,但我认为这会使用您所指的元数据.我不确定是否可以在不实际布置文档的情况下获得页数.因此,您可能不得不诉诸使用API​​来驱动真正的Office兼容应用程序,例如OpenOffice或AbiWord.

I was going to say wvSummary, but I think this uses the metadata you're referring to. I'm not sure there is a way to get the page count without actually laying out the document. So you might have to resort to using APIs to drive a real Office-compatible application like OpenOffice or AbiWord.

这篇关于在Linux上的Microsoft Word文档中以编程方式获取页数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆