Link to home
Start Free TrialLog in
Avatar of PinkDolphin
PinkDolphin

asked on

Notes richtext item. What happen?

Hi,

I need to append text and a richtext item to a memo.
I've got something like this:

Set rtitem = New NotesRichTextItem( memo, "tmpBody" )
Set rtitem1 = New NotesRichTextItem( memo, "Body" )

Call rtitem.Appendtext(changedesc$)
Set descrtitem= currentdoc.GetFirstItem("ChangeDesc")
Call rtitem.AppendRTItem(descrtitem)
Call rtitem.Appendtext(changedesc$)
     
Call rtitem1.AppendRTItem(rtitem)

I couldn't see the content in the richtext item and the text appended thereafter.
However, when I look at the Body field in document properties, it's there.

Why can't I see in the email?


Thank You.
Avatar of CRAK
CRAK
Flag of Netherlands image

Did you save the document?
If you check the documents properties (fields), has tmpBody been added?

I had similar problems before in R4 once. I solved it by reading the NotesRTItem.text property after appending text/richtext/new lines to it. Strange but true....
Avatar of HemanthaKumar
HemanthaKumar

Instead of creating item, just get the handle to the item

Set rtitem = New NotesRichTextItem( memo, "tmpBody" )
Set rtitem1 = New NotesRichTextItem( memo, "Body" )

replace with

set rtitem = currentdoc.GetFirstItem("tmpBody")
set rtitem1 = currentdoc.GetFirstItem("Body")

~Hemanth
Avatar of PinkDolphin

ASKER

Yes, this is what I did.

use GetFirstItem, then use AppendRTItem

Set rtitem = New NotesRichTextItem( memo, "Body" )
Set descrtitem= currentdoc.GetFirstItem("ChangeDesc")

Call rtitem.Appendtext(changedesc$)
Call rtitem.AppendRTItem(descrtitem)

I thought this is straightforward. The funny thing is I can't see the content for AppendRTItem; can only see value of changedesc$. But when I go to the document properties, I can see the content for AppendRTItem in the Body field.



Oops...to add on.
when I say I can't see the content for AppendRTItem, I mean I don't see it when I open the email. But it is in the Body field in  document properties


How many body fields are listed in the document ???

I was refering to body item, if it is already available get the handle and if does'nt then create a new body item
I created a new body item in my memo document.

There is only 1 body field. I'm trying to append text, as well as another richtext item into this body field.

However, the content in the richtext item cannot be seen in the memo although the body field in the document properties shows the content.

Hope I've explained myself clear.

Thanks.



ASKER CERTIFIED SOLUTION
Avatar of CRAK
CRAK
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Don't append the text just appendrtitem and see if u can see the appended item.

& then

Try this

                     Set rtitem = New NotesRichTextItem( memo, "Body" )
                     Set descrtitem= currentdoc.GetFirstItem("ChangeDesc")

                     Call rtitem.Appendtext(changedesc$)
Call rtitem.AddNewLine(1,true)
                     Call rtitem.AppendRTItem(descrtitem)


Also check this
http://support.lotus.com/sims2.nsf/eb5fbc0ab175cf0885256560005206cf/14463992904c7cc48525636b004d273d?OpenDocument

Even if i just append the richtext item, the content is not displayed in the mail. However, you can see the value in the body field in document properties. i thought whatever is in the field in the document properties, you would be able to see on the form if the field is there. The body field is definitely on the memo form. How could it be hidden?

I tried exactly the same codes on another form. It works.

I'm thinking of re-creating the same form, but there are too many fields on the form, it will take a lot of time.

Experts out there, any idea? I'm at a loss, I wouldn't want to waste my time re-creating the form and try again.

Thank You.
 ~Desparate for help~

PinkD..
Just recently joined this exchange, so hadn't seen your note.  If a rich text item already exists on a document, you instantiate the rtitem as a variant, rather than a New Rich Text item, else you create another instance of the rtitem. (which is the one that you see in the properties, but doesn't show up on the form)

If its a new unsaved document, then you instantiate it as New Rich Text item, because the body field does not yet exist until the document is saved.

Whenever you update or add to a rt item, you have to close and open the document to see the changes.

Also, if the item exists, you can use standard item methods to append, unless you need to format the rich text in special ways with font colors, etc.

Hope this helps.
Marilyng