JAVA/CORBA CLASSES
Examples: RichTextItem class
1. This agent creates a rich text item and appends text to it.
import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext =
session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
Document doc = db.createDocument();
Item subject = doc.replaceItemValue("Subject",
"Project description");
RichTextItem body = doc.createRichTextItem("Body");
body.appendText("Cartoon book for children
ages 9-12");
// Print text of subject and body
System.out.println(subject.getText());
System.out.println(body.getText());
// Save the document
doc.save(true, true);
} catch(Exception e) {
e.printStackTrace();
}
}
}
2. This agent gets a rich text item.
import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext =
session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
DocumentCollection dc = db.getAllDocuments();
Document doc = dc.getFirstDocument();
Item subject = doc.getFirstItem("Subject");
RichTextItem body =
(RichTextItem)doc.getFirstItem("Body");
// Print text of subject and body
System.out.println(subject.getText());
System.out.println(body.getText());
} catch(Exception e) {
e.printStackTrace();
}
}
}
See Also
RichTextItem class
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary