如何使用 apache poi 遍历 word 文档中的每一页?

How to iterate through every pages in a word document using apache poi?

apache poi 中是否有任何函数可以让您遍历 word 文档中的每一页?类似于 HSLF 组件,您可以在其中访问 powerpoint 文件中的每个幻灯片内容?

我不确定如何遍历 word 文档中的每一页,但我编写了这段代码,使用 poi 和 jSoup 提取所有部分:

   private List<String> extractListOfSections() {

        String content = parse.getXMLHandler().toString();
        Document doc = Jsoup.parse(content);
        List<Element> link = doc.select("h, h1, h2, h3, h4, h5, h6");

        List<String> headings = new ArrayList<String>();

        for (Element element : link) {
            if (element.text() != null) {
                headings.add(element.text().replaceAll("\p{P}", " "));
            }
        }

        return headings;

    }

然后我使用这个列表来提取每个部分的内容。