xwpf获取段落的行号

时间:2018-12-24 01:00:31

标签: document paragraph line-numbers xwpf

如何获取段落的lineNumber。我想知道我在一段文本中创建了多少行。

String kalimat="Aaaa bbb ccc ddd eee fff ggggg hh iii jjj kkk lll mmm nnn. Oooo ppp qqq rrr sss ttt uuu vvvv ww xxxxx y zzz.";  

XWPFParagraph paragraph = document.createParagraph();
XWPFRun run = paragraph.createRun();

paragraph.setAlignment(ParagraphAlignment.BOTH);
paragraph.setSpacingBefore(0);
paragraph.setSpacingAfter(0);
paragraph.setSpacingBetween(1.5);

run.setFontFamily("Bookman Old Style");
run.setFontSize(12);
run.setText(kalimat);

我想知道,用此文本(kalimat)为该段创建了多少行。 谢谢...

0 个答案:

没有答案