java如何获取word文档页数

java如何获取word文档页数,第1张

XWPFDocument docx = new XWPFDocument(POIXMLDocumentopenPackage(电月度例会会议纪要docx));

int pages = docxgetProperties()getExtendedProperties()getUnderlyingProperties()getPages();//总页数

int wordCount = docxgetProperties()getExtendedProperties()getUnderlyingProperties()getCharacters();// 忽略空格的总字符数 另外还有getCharactersWithSpaces()方法获取带空格的总字数。

Systemoutprintln (pages= + pages + wordCount= + wordCount);}

public static void parse97() throws Exception {

WordExtractor doc = new WordExtractor(new FileInputStream(电月度例会会议纪要doc));

using MSWord = MicrosoftOfficeInteropWord;

//方法内容

private MSWordApplication wordApp; //Word应用程序变量

private MSWordDocument wordDoc; //Word文档变量

private Object Nothing = MissingValue;

//初始化

wordApp = new MSWordApplicationClass();

wordDoc = wordAppDocumentsAdd(ref Nothing, ref Nothing, ref Nothing, ref Nothing);

// 打开Word

object FileName = strPath;

object readOnly = false;

object isVisible = true;

wordDoc = wordAppDocumentsOpen(ref FileName, ref Nothing, ref readOnly,

ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing,

ref Nothing, ref Nothing, ref Nothing, ref isVisible, ref Nothing,

ref Nothing, ref Nothing, ref Nothing);

// 计算Word文档页数

MSWordWdStatistic stat = MSWordWdStatisticwdStatisticPages;

int num = wordDocComputeStatistics(stat, ref Nothing);

int wordNum=wordDocCharactersCount;//文档字数

WinXP系统的,用这个!切换到 编辑文件摘要功能卡,添加文件列表,然后单击导出文件详情按钮,如下图所示,选择导出项目为页数。

所有系统,用这个!切换到文档批处理功能卡,选择Pdf类型,然后启用新的功能模块。

这里可以导出Pdf,word类型的文档的页数,添加文件列表之后,使用保存页数按钮即可。

以上就是关于java如何获取word文档页数全部的内容,包括:java如何获取word文档页数、C# Microsoft.Office.Interop.Word怎么获取页数和字数、如何一次性统计多个文档的总页数等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/9300106.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-26
下一篇 2023-04-26

发表评论

登录后才能评论

评论列表(0条)

保存