createRichTextItem (NotesDocument - JavaScript)

Creates a new rich-text item in a document.

Defined in

NotesDocument

Syntax

createRichTextItem(name:string) : NotesRichTextItem
Parameter Description
name The name of the new rich-text item.
Return value Description
NotesRichTextItem The newly created item.

Usage

For more information, see the NotesRichTextItem class.

Examples

This button creates a new document in the current database with a rich text item containing text and an attachment.
try {

var doc:NotesDocument = database.createDocument();
doc.appendItemValue("Form", "main");
var image:string = requestScope.query;
doc.appendItemValue("Subject", image);
var rtitem:NotesRichTextItem = doc.createRichTextItem("Body");
rtitem.appendText("Attached is " + image + ".");
rtitem.addNewLine();
rtitem.embedObject(NotesEmbeddedObject.EMBED_ATTACHMENT, "", image, null);
doc.save();
requestScope.status = "Created document for image " + image;

} catch(e) {
	requestScope.status = "Could not create document for image " + image;
}