JAVA/CORBA CLASSES


Examples: setStyle method
This agent changes to blue the content of the first table in the current 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_TABLE)) {
       RichTextRange rtrange = body.createRange();
       rtrange.setBegin(rtnav);
       rtrange.setEnd(rtnav);
       RichTextStyle rtstyle = session.createRichTextStyle();
       rtstyle.setColor(RichTextStyle.COLOR_BLUE);
       rtrange.setStyle(rtstyle);
       doc.save(true, true);
     }
     else
       System.out.println("Body does not contain any tables");

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

See Also