简体   繁体   中英

How to get no of lines in a MS word file(.doc) using a java program

By using Apache POI I am able to get data from MS Word documents but the problem here is, the Word file is read as paragraphs. So each paragraph is read as single line. My java code line count doesn't match with the line count given by .doc file. Can anyone suggest me how to get line-count using Apache POI or any alternative ways.

the following way may be preferable for you

        DocumentSummaryInformation summaryInfo=doc.getDocumentSummaryInformation();
        String category = summaryInfo.getCategory();
        String company = summaryInfo.getCompany();
        int lineCount=summaryInfo.getLineCount();

refer java-and-docx-format

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM