Rich Text Section Content

How to get the content of a rich text section from a java agent. I can only get the section title by section.getTitle() but not the content. If there are other text in the rich text field then I just need the section body. Can anybody help me specifically please !!!

Subject: Rich Text Section Content

try it

import lotus.domino.*;

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {

  Session session = getSession();

  AgentContext agentContext = session.getAgentContext();



  DocumentCollection dc = agentContext.getUnprocessedDocuments();

  Document doc = dc.getFirstDocument();

  RichTextItem body = (RichTextItem)doc.getFirstItem("Body");

  RichTextNavigator rtnav = body.createNavigator();

  RichTextRange rtrange = body.createRange();

  if (rtnav.findFirstElement(

  RichTextItem.RTELEM_TYPE_SECTION)) {

    String searchString = "foo";

    boolean foundit = false;

    do {

      rtrange.setBegin(rtnav);

      String para = rtrange.getTextParagraph();

      if (para.toLowerCase().indexOf(searchString) >= 0) {

        foundit = true;

        break;

      }

    } while (rtnav.findNextElement(RTELEM_TYPE_TEXTPARAGRAPH)); // don't know where end section it's problem

    if (foundit)

      System.out.println(

        "Body contains \"" + searchString + "\"");

    else

      System.out.println(

        "Body does not contain \"" + searchString + "\"");

  }

  else

    System.out.println("Body does not contain section");



} catch(Exception e) {

  e.printStackTrace();

}

}