【发布时间】:2020-06-29 12:07:35
【问题描述】:
我的代码在 LibreOffice 5 之前运行良好。但在 LibreOffice 6(32 位和 64 位)中它停止工作。
public String getNextSentenceOO() {
while (moreParagraphsOO) {
while (moreSentencesOO) {
xSentenceCursor.gotoEndOfSentence(true);
textSentence = xSentenceCursor.getString();
xTextViewCursor.gotoRange(xSentenceCursor.getStart(), false);
xTextViewCursor.gotoRange(xSentenceCursor.getEnd(), true);
if (!textSentence.equals("")) {
return textSentence;
}
moreSentencesOO = xSentenceCursor.gotoNextSentence(false);
if (xSentenceCursor.isEndOfSentence() && !xSentenceCursor.isStartOfSentence()){
moreSentencesOO = false;
}
}
moreParagraphsOO = xParagraphCursor.gotoNextParagraph(false);
moreSentencesOO = xSentenceCursor.gotoStartOfSentence(false);
}
return null;
}
当文档中存在空行时会出现问题。在这种情况下,指令:
moreParagraphsOO = xParagraphCursor.gotoNextParagraph(false);
不使光标前进到下一段,它保持在同一个地方,所以函数进入一个无限循环。有什么想法吗?
正如我所说,这在 LibreOffice 4 和 5 中运行良好(即使在 LO5 的最新版本中也是如此)。它在 LO6 中停止工作。
【问题讨论】:
标签: java libreoffice openoffice.org