Lotus Notes and C #: NotesRichTextItem how to recreate content or cyclically move items in the appropriate order

I am currently exporting a Lotus Notes database using the C # Interop Domino build from NuGet,

I did not find a way to identify objects or elements in NotesRichTextItem in the order in which they were entered, for example, maybe I first enter a paragraph, then a table, and then an attachment. Is there a way to iterate over the elements in their order?

I found a way to find elements with FindFirstElement, but you need to pass the type of the element you are looking for, it is very difficult, since retrieving all elements without order will cause the content to lose its context.

thanks

+4
source share
2 answers

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

enter image description here

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(); } } } 
+3
source

Unfortunately, the API gives you no way to do this:

Navigation is inside elements of the same type. You can find or get the first type element, the next type element, and the nth type element. You cannot find or retrieve an item, regardless of type.

http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.main.doc/H_NOTESRICHTEXTNAVIGATOR_CLASS.html

UPDATE: I forgot to mention that you might want to check out a third-party tool from Genii Software called MidasLSX that might help you. http://www.geniisoft.com/showcase.nsf/MidasLSX

+2
source

Source: https://habr.com/ru/post/1490957/


All Articles