例: setCharOffset method

次のエージェントは、9 番目の文字で始まる最初のテキスト段落を取得します。

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)) {
        rtnav.setCharOffset(8);
        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();
    }
  }
}