Search This Blog

Sunday, January 13, 2013

Compilation of Richtext item exporting options


At the end of 2012 I started to work on iGlobe company where my main responsibly was to support all kind of data migration solutions.

Yes, you are right, I am helping to migrate people to other platforms from the Lotus Notes. Hope you will not blame me too much :-) for assisting in IBM Notes killing - its just a part of my duties.

Basically I work on different tasks regarding migration data from IBM (Lotus) Notes applications to MS Sharepoint solutions, Oracle solutions etc.

I decided to publish a series of posts with different solutions about LN data migration on my blog. So keep an eye on it :-)

My first post is about NotesRichtext Item conversion options. Some customers are quite agree about conversion of richtext items to either html-files or rtf-files which may be stored as attachments in any external systems.

You may find below a link to the nsf-file with next Notes agents which contain implementation of different conversion approaches:

  1. Get HTML from Richtext item - Based on MIME with UI
  2. Get HTML from Richtext item - Based on MIME without UI
  3. Get HTML from Richtext item - Based on MIME without UI 2
  4. Get HTML from Richtext item - Using nHTTP task
  5. Get HTML from Richtext item - Using NotesApi
  6. Get RTF-file from Richtext - Using NotesApi
  7. Get RTF-file from Richtext - Using NotesApi 2

First thing I want to say is that I did not write all of them from the scratch. I spent some time on Googling of existing solution and made a compilation of all workable solutions I found in Internet. Most of these solution were found on and but almost all of them were more or less changed by me.

Second important thing is that all these solution have their own limitations and issues. I mean, they are good enough for conversion of simple richtext content but in case of really mixed richtext data (with pictures, attachments etc) they need additional work.
However my goal was to provide you with initial working prototypes which you can enhance to satisfy your needs. This post allows you to get a collection of existing in Internet solutions, which were enhanced a little by me and tested with IBM Notes 9.

Brief comments about every solution:

  1. Get HTML from Richtext item - Based on MIME with UI: this solution is based on conversion of richtext content to MIME and then writing it to the html-file. MIME conversion is based on resaving of target NotesDocument in UI using custom form with "Store contents as HTML and MIME" property enabled for a richtext field. So the main limitation of this solution is that you can not use it in background agents. I almost did not change this solution.
  2. Get HTML from Richtext item - Based on MIME without UI: this solution is almost the same against the solution №1 with the only one but important difference: I changed the way of MIME conversion here. With IBM Lotus Notes 8.5.1 and higher we have a new method for NotesDocument class - it is the NotesDocument.ConvertToMIME() method. This method is capable to convert a NotesDocument with all items to MIME so it makes our goal easier to achieve and allow us to use it in background agents.
  3. Get HTML from Richtext item - Based on MIME without UI 2: this solution is almost the same against the solution №2 - I just rewrote a lotus script code to make it much lighter.
  4. Get HTML from Richtext item - Using nHTTP task: this solutions is based on standard capabilities of HTTP task of Domino server to convert a NotesDocument to HTML. The idea is simple - I open target document with required richtext item through HTTP, then grab generated by Domino server HTML and then put it to html-file. Limitations of such method are obvious: 
    • it works only with participation of Domino server
    • it requires authentication to be passed.
  5. Get HTML from Richtext item - Using NotesApi: this solution is based on NotesApi functions defined in nnotes.dll. It is obvious, that this solution can work only on Windows platform.
  6. Get RTF-file from Richtext - Using NotesApi: as you may see, the result of this solution is rtf-file. It can work only on Windows platform.
  7. Get RTF-file from Richtext - Using NotesApi 2: it is the same as solution №6 but there are a few differences inside. Anyway, either this solution or previous one are based on NotesApi functions MailGetMessageBodyComposite and ExportRTF from nnotes.dll so it does not matter very much what option you choose finally.
Two additional notes:

  • Almost all solution may convert not only a NotesRichtext item from the NotesDocument but whole NotesDocument itself to HTML/RTF
  • If you try any of this solution on your NotesDocument and you get an error then I suggest you to try it on a copy of this document associated with as simple form as possible. For example, Memo/Reply/... form, that it is associated with emails in your Inbox contains hundreds of controls, event handlers, @Formulas etc. If you want to convert your email to HTML-file using solutions from the list above it is better to use some more simple form with only fields Subject, SendTo/CC/BCC, Body. So you could just create a copy of your email, associate it with such simplified Form and then apply required conversion method.
Guys, if you have another solution regarding exporting of Richtext item, please send it to me. I will update my post and include it into database below.



  1. Hi,
    Unfortunately database link you provided dont work..

    Also I am trying to export a picture on a lotus notes form to a jpeg file since it is a photo..

    so which solution you recommend for that i dont need a rtf file i need a jpeg or picture file?

  2. Just checked the link - it works.
    Can you send me a screen shot where I will be able to see the problem?

    You said export picture from a FORM ? Not a Document ?

    1. No, it doesn't work! Not sure how to post a screenshot here. Got an error message the first time saying the file does not exist at this location and now it is sitting there with nothing happening at all just waiting trying to load.

    2. OK, depends on version of Browser. ie8 does not work. ie11 does.

  3. This comment has been removed by a blog administrator.

  4. Am not able to download the file ..could you please provide me the link

  5. I found this quite easy solution:
    Just Invoke the field wanted and save it with the right codepage!
    I had nothing to change in my databases, views or forms!

  6. wow, so nice, didn't know about this URL before
    thank you very much

  7. Good Night.
    The rtf document was exported without picture. What do i do to export a picture of rich text field of the document?