Generating HTML from RichText fields

Hello All,

I know that when I view a document with a rich text field through a browser that Domino renders the rich text content as HTML. Is it possible to mimic this process in LotusScript?

What I’m saying is I would like to generate the HTML version (so to speak) of a rich text field’s content (Including links) into a LotusScript variable (string) and pass that to another function. Like a web agent that generates a web page.

Any help would be great!

Thank you!

Subject: Generating HTML from RichText fields

If a third party product is acceptable, our Midas Rich Text LSX does this and offers a great deal of additional flexibility as well, such as allowing you to determine what to do with images, how exactly to resolve links, determine whether to enforce accessibility standards, whether to use XHTML or HTML, and whether to use CSS to render a more exact replica of the rich text than Domino does.

Subject: RE: Generating HTML from RichText fields

Thank you for the Info, but I’m just looking for basic functionality. Any else?

Thank you!

Subject: RE: Generating HTML from RichText fields

You can do a GetDocumentByURL and retrieve the HTML from there, or you can set the rich text field to save as MIME and then retrieve the HTML from there. Both methods have some configuration issues, but are available if that is what you wish.

Subject: RE: Generating HTML from RichText fields

hi ben

i am interrested with this.

i am using the GetDocumentByURL, and the body field i am getting is of type HTML when it cannot read the URL and of type MIME_part when it is able to read the URL, but in both cases i cannot read the content.

can you help me?

thanks

Charbel

Subject: RE: Generating HTML from RichText fields

When it is MIME, use the NotesMIMEEntity class to read the content.

Subject: Generating HTML from RichText fields

You can get a rich representation of Rich Text content by exporting document(s) as DXL (Domino XML). You can then use either an XSLT (transformation stylesheet) to create HTML automagically, or you can use the DOM or SAX parsers to transform the XML to HTML. Check the Designer Help on NotesNoteCollection (which will be the source of the export), NotesDXLExporter, and NotesStream. The only bugaboo will be pasted images, which are in a Notes proprietary format (Notes bitmap) – you pretty much need to preview the document in a web browser and save the images from the browser to get a usable (GIF or JPEG) format (unless there’s a tool in the C API to do the conversion – I haven’t done much with it).

Subject: New Property: NotesDXLExporter.ConvertNotesBitmapsToGIF = True

Subject: RE: New Property: NotesDXLExporter.ConvertNotesBitmapsToGIF = True

That be prima facie kewl. Shall endeavor to use.

Subject: RE: Generating HTML from RichText fields

Thank you Stan.

I have been meaning to learn the DXL objects anyway. Now is the time.

Thanks again!

Subject: RE: Generating HTML from RichText fields

I like this idea and my initial testing looks promising, I’ve just got one issue (for now).

I am trying to modify a database that was created with the Discussion Database template. What I would like to do is make it look and feel more like a “normal” forum (the user’s choice of words, not mine).

So I’m trying to write a web agent that will pull together all of the documents for a particular thread ID and generate one page that displays the rich text from each document in the thread (and I do want to keep all the fancy formatting you can create in RT fields).

My problem, it would appear that users have been pasting content from emails and Internet pages into the forum and a good number of the documents would appear to be in MIME (MIME-Version: 1.0

Content-Transfer-Encoding: binary

Content-Type: text/html; charset=UTF-8), which renders into “junk” using the DXLExporter.

Any suggestions on how I can accomplish my objective given the mix of MIME and non-MIME rich text items?

Thank you.

Mike

PS. And no Ben, we’re not open to buying a third-party option at this time, as much as I’d like to just use your Midas product.

Subject: RE: Generating HTML from RichText fields

The “junk” is Base64-encoded. There is decoding code aplenty on the web, including here:

http://www.freevbcode.com/ShowCode.asp?ID=1085