Examples: setTitleStyle method

This agent sets the title style of every section in a rich text item.

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_SECTION)) {
        RichTextStyle rtstyle = session.createRichTextStyle();
        rtstyle.setFontSize(12);
        do {
          RichTextSection rtsection = (RichTextSection)rtnav.getElement();
          rtsection.setTitleStyle(rtstyle);
        } while (rtnav.findNextElement());
        doc.save(true, true);
      }
      else
        System.out.println("Body does not contain any sections");

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