RendertoRTF issue

Hi,

I am trying to copy a document to a RT field so that the user will be able to print the document and not loose any formatting.

However, when I call the new tempdoc, the RT field is actually empty. When I step through the Debugger it is seems like the content is actually copied. Any help appreciated…

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim db As NotesDatabase

Dim uidoc As NotesUIDocument

Dim thisdoc As NotesDocument

'This sets the db to the current db

Set db = session.CurrentDatabase

'**This captures the current document

Set uidoc = ws.CurrentDocument

'**This takes it to the backend

Set thisdoc = uidoc.Document

Dim tempDoc As New NotesDocument(thisdoc.ParentDatabase)

Dim rtitem As New NotesRichTextItem(tempDoc, “Print”)

'** render the document to a rich text field

If thisdoc.RenderToRTItem(rtitem) Then

tempdoc.form=“Print”

Call tempDoc.Save(True, True)

'** To see result as test

Set uidoc = ws.EditDocument(True,tempdoc,True)

Subject: RendertoRTF issue

Is the rich text field also called Print?

Subject: RE: RendertoRTF issue

As an aside I don’t think you actually need to save tempdoc before viewing it, as long as thisdoc as been saved.

Subject: RE: RendertoRTF issue

Hi Thomas,

Yes, the field name is also called Print

I have been very frustrated by this. I am using the same method in other databases without an issue.

Also, I cannot find more info about this other than the designer help, which does not help.

Have you tried something similiar? Or is there perhaps another way?

Regards

Bafie

Subject: RE: RendertoRTF issue

All I can think of is that you are doing this in an odd way, assigning the form after rendering the item. And I always use notessession to get the current database, never parentdatabase. Try this:

set tempdoc = db.createdocument

with tempdoc

call .replaceitemvalue(“Form”,“Print”)

set rtitem = .createrichtextitem(“Print”)

end with

call thisdoc.rendertortitem(rtitem)