次のエージェントは、アイテム内のテキスト段落にアクセスする範囲を作成します。
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
// Open file - proceed only if file can be opened
String filename = "c:¥¥lotus¥¥notesv6¥¥notes.ini";
Stream stream = session.createStream();
DocumentCollection dc = agentContext.getUnprocessedDocuments();
Document doc = dc.getFirstDocument();
RichTextItem rti = (RichTextItem)doc.getFirstItem("Body");
RichTextNavigator rtnav = rti.createNavigator();
if (rtnav.findFirstElement(
RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) {
RichTextRange rtrange = rti.createRange();
do {
rtrange.setBegin(rtnav);
System.out.println(rtrange.getTextParagraph());
} while (rtnav.findNextElement());
}
else
System.out.println("No text in Body.");
} catch(Exception e) {
e.printStackTrace();
}
}
}