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 rti = (RichTextItem)doc.getFirstItem("Body");
RichTextNavigator rtnav = rti.createNavigator
rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH);
rti.beginInsert(rtnav);
rti.appendText("Beginning text.");
rti.addNewLine(1);
rti.endInsert();
doc.save(true, true);
} catch(Exception e) {
e.printStackTrace();
}
}
}
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 rti = (RichTextItem)doc.getFirstItem("Body");
RichTextNavigator rtnav = rti.createNavigator
if (rtnav.findNthElement(
RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH, 2)) {
rti.beginInsert(rtnav, true);
rti.addNewLine(1);
rti.appendText("Text following 2nd paragraph.");
rti.endInsert();
doc.save(true, true);
}
else
System.out.println("No 2nd paragraph.");
} catch(Exception e) {
e.printStackTrace();
}
}
}