Examples: findLastElement method
This agent finds the last text paragraph in the Body item of the current or last selected document.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
DocumentCollection dc = agentContext.getUnprocessedDocuments();
Document doc = dc.getFirstDocument();
RichTextItem body = (RichTextItem)doc.getFirstItem("Body");
RichTextNavigator rtnav = body.createNavigator();
if (rtnav.findLastElement(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) {
RichTextRange rtrange = body.createRange();
rtrange.setBegin(rtnav);
System.out.println(rtrange.getTextParagraph());
}
else
System.out.println("No text in Body item");
} catch(Exception e) {
e.printStackTrace();
}
}
}