aspsoe获取word指定位置文本

Document doc = new Document("xxx.doc");
DocumentBuilder documentBuilder = new DocumentBuilder(doc);
documentBuilder.moveToBookmark("content");
Paragraph currentParagraph = documentBuilder.getCurrentParagraph();
String text = currentParagraph.getText().trim().substring(5);

//多个段落

ArrayList list = new ArrayList<>();
list.add(text);
for (int i = 0; i <= 100; i++) {
    Node nextSibling = currentParagraph.getNextSibling();
    if (nextSibling == null) {
        break;
    }
    String text1 = nextSibling.getText().trim();
    list.add(text1);
    currentParagraph = (Paragraph) nextSibling;
}
String join = StrUtil.join("\r\n", list);

你可能感兴趣的:(java,javascript,servlet)