JAVA/CORBA CLASSES


Examples: findNextElement method
This agent displays each paragraph in the Body item of the current or first 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.findFirstElement(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) {
       RichTextRange rtrange = body.createRange();
       int count = 0;
       do {
         count++;
         rtrange.setBegin(rtnav);
         System.out.println(count + ") " + rtrange.getTextParagraph());
       } while (rtnav.findNextElement());
     }
     else
       System.out.println("No text in Body item");

   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also