There is a way to parse elements of a RichText Notes document using DXL , a special XML format for Notes. Use DxlExporter to export a Notes document to DXL format. You can "walk" through XML and get the contents of the RichText element with the elements in the correct order.
For this RichText element, for example

you will get this dxl
<item name='Body'> <richtext> <pardef id='1'/> <par def='1'>aaaaaaa</par> <table widthtype='fixedleft' refwidth='1.0667in'> <tablecolumn width='0.6729in'/> <tablecolumn width='0.3938in'/> <tablerow> <tablecell> <pardef id='3' keepwithnext='true' keeptogether='true'/> <par def='3'>111</par></tablecell> <tablecell> <pardef id='4' keepwithnext='true' keeptogether='true'/> <par def='4'>222</par></tablecell> </tablerow> <tablerow> <tablecell><par def='3'>333</par></tablecell> <tablecell><par def='4'>444</par></tablecell> </tablerow> </table> <pardef id='5' leftmargin='1.2500in' list='bullet'/> <par def='5'>xxx</par> <par def='5'>yyy</par> <par def='5'>zzz</par> <pardef id='6' leftmargin='1in'/> <par def='6'> <attachmentref name='icon16.gif' displayname='icon16.gif'> <picture height='34px' width='61px'> <notesbitmap>lQAmAAAAAAAAAAAAA...</notesbitmap> <caption>icon16.gif</caption> </picture> </attachmentref> </par> </richtext> </item>
Here is a Java agent that exports selected documents to a file.
import lotus.domino.*; public class JavaAgent extends AgentBase { @Override public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); DocumentCollection dc = agentContext.getUnprocessedDocuments(); String filename = "c:/temp/exportDocs.dxl"; Stream stream = session.createStream(); if (stream.open(filename)) { stream.truncate(); DxlExporter exporter = session.createDxlExporter(); exporter.setRichTextOption(0); exporter.setMIMEOption(0); stream.writeText(exporter.exportDxl(dc)); } else { System.out.println("Cannot open " + filename); } } catch (Exception e) { e.printStackTrace(); } } }
source share