How to Add Text to a Rich Text Object

Unlike a text field, where you assign a text string to an object, a Rich Text field requires additional statements using the NotesRichTextItem class. The methods and properties associated with this class enable you to insert text strings and format a Rich Text field.

How It Works

In order to reference a Rich Text field, you must instantiate a NotesRichTextItem object. Then using methods such as AddNewLine and AppendText, you can change the text and appearance of the Rich Text object.

Implementation

To insert text in a new Rich Text field, you must obtain a handle to a document (doc) and create a NotesRichTextItem object. The following will insert a single blank line, the statement "This is a test", and another blank line in a field called ATTACHMENTS. To implement this code, replace ATTACHMENTS with the appropriate Rich Text field name.

Dim s As NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim rtitem as NotesRichTextItem

Set s = New NotesSession
Set db = s.CurrentDatabase
Set doc = New NotesDocument (db)
Set rtitem = New NotesRichTextItem(doc, "ATTACHMENTS")

Call rtitem.AddNewLine(1)
Call rtitem.AppendText("This is a test")
Call rtitem.AddNewLine(1)



An Introduction to the Lotus Domino Tool Suite

Getting Started with Designer

Navigating the Domino Designer Workspace

Domino Design Elements

An Introduction to Formula Language

An Introduction to LotusScript

Fundamentals of a Notes Application

Calendar Applications

Collaborative Applications

Reference Library Applications

Workflow Applications

Web Applications

Design Enhancements Using LotusScript

Design Enhancements Using Formula Language

View Enhancements

Sample Agents

Miscellaneous Enhancements and Tips for Domino Databases

Data Management

Security

Application Deployment and Maintenance

Troubleshooting

Appendix A. Online Project Files and Sample Applications

Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?

show all menu





Lotus Notes Developer's Toolbox(c) Tips for Rapid and Successful Deployment
Lotus Notes Developers Toolbox: Tips for Rapid and Successful Deployment
ISBN: 0132214482
EAN: 2147483647
Year: N/A
Pages: 293
Authors: Mark Elliott
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net