XWPFDocument returning 1 number of pages for docx file

↘锁芯ラ 提交于 2020-05-15 09:28:04

问题


I am using XWPFDocument library to find number of pages in docx file. Below is my code snippet :

XWPFDocument docx = null;
            try {
                docx = new XWPFDocument(POIXMLDocument.openPackage(filePath));
                totalPages = docx.getProperties().getExtendedProperties().getUnderlyingProperties().getPages();
            } catch (IOException e) {
                logger.error("Error while loading word document at file location {}", filePath);
                totalPages = 0;
            }

For some .docx it is working fine but for some files it is returning 1 inspite of having more than 30 pages.

来源:https://stackoverflow.com/questions/44650147/xwpfdocument-returning-1-number-of-pages-for-docx-file

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