JAVA/CORBA CLASSES
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(); RichTextRange rtrange = body.createRange(); int[] elemType = new int[8]; elemType[0] = RichTextItem.RTELEM_TYPE_DOCLINK; elemType[1] = RichTextItem.RTELEM_TYPE_FILEATTACHMENT; elemType[2] = RichTextItem.RTELEM_TYPE_OLE; elemType[3] = RichTextItem.RTELEM_TYPE_SECTION; elemType[4] = RichTextItem.RTELEM_TYPE_TABLE; elemType[5] = RichTextItem.RTELEM_TYPE_TABLECELL; elemType[6] = RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH; elemType[7] = RichTextItem.RTELEM_TYPE_TEXTRUN; for (int i = 0; i < 8; i++) { if (rtnav.findFirstElement(elemType[i])) { do { rtrange.setBegin(rtnav); rtrange.setEnd(rtnav); displayRange(rtrange); } while (rtnav.findNextElement()); } else System.out.println( "No elements of type " + getTypeString(elemType[i])); } } catch(Exception e) { e.printStackTrace(); } } void displayRange(RichTextRange range) { try { System.out.println("*" + getTypeString(range.getType()) + "*"); if (range.getType() == RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH) System.out.println(range.getTextParagraph()); else if (range.getType() == RichTextItem.RTELEM_TYPE_TEXTRUN) System.out.println(range.getTextRun()); } catch(Exception e) { e.printStackTrace(); } } String getTypeString(int elemType) { String elemTypeString = "Unknown"; switch (elemType) { case RichTextItem.RTELEM_TYPE_DOCLINK : elemTypeString = "Doc link"; break; case RichTextItem.RTELEM_TYPE_FILEATTACHMENT : elemTypeString = "File attachment"; break; case RichTextItem.RTELEM_TYPE_OLE : elemTypeString = "OLE object"; break; case RichTextItem.RTELEM_TYPE_SECTION : elemTypeString = "Section"; break; case RichTextItem.RTELEM_TYPE_TABLE : elemTypeString = "Table"; break; case RichTextItem.RTELEM_TYPE_TABLECELL : elemTypeString = "Table cell"; break; case RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH : elemTypeString = "Text paragraph"; break; case RichTextItem.RTELEM_TYPE_TEXTRUN : elemTypeString = "Text run"; } return(elemTypeString); } }
See Also