使用aspose获取Word文档中的页数 [英] get the number of pages in a word document using aspose

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

问题描述

如何使用Aspose Java获取Word文档(.doc或.docx)中的页数? 或者也许可以在不使用Aspose的情况下在Java中获取Word文档中的页数.

how can i get the number of pages in a word document(.doc or .docx) using Aspose java? or maybe get the number of pages in a word document in java without using Aspose.

推荐答案

您可以使用Document.getPageCount方法获取Aspose.Words for Java中doc/docx文件的页数.以下是示例代码:

You can use Document.getPageCount method to get the page count of a doc / docx file in Aspose.Words for Java. Following is the sample code:

//Open the Word Document                                 
Document doc = new Document("C:\\Data\\Image2.doc");     

//Get page count                                         
int pageCount = doc.getPageCount();

//Print Page Count            
System.out.println(pageCount);

希望这会有所帮助.

这篇关于使用aspose获取Word文档中的页数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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