public List<String> getParagraphWords(int paragraphIndex) { final ArrayList<String> words = new ArrayList<String>(); final ZLTextWordCursor cursor = new ZLTextWordCursor(getReader().getTextView().getStartCursor()); cursor.moveToParagraph(paragraphIndex); cursor.moveToParagraphStart(); while (!cursor.isEndOfParagraph()) { ZLTextElement element = cursor.getElement(); if (element instanceof ZLTextWord) { words.add(element.toString()); } cursor.nextWord(); } return words; }
public String getParagraphText(int paragraphIndex) { final StringBuffer sb = new StringBuffer(); final ZLTextWordCursor cursor = new ZLTextWordCursor(getReader().getTextView().getStartCursor()); cursor.moveToParagraph(paragraphIndex); cursor.moveToParagraphStart(); while (!cursor.isEndOfParagraph()) { ZLTextElement element = cursor.getElement(); if (element instanceof ZLTextWord) { sb.append(element.toString() + " "); } cursor.nextWord(); } return sb.toString(); }