次のエージェントは、現在の文書の最初の表の内容を青に変えます。
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();
}
}
}