JAVA/CORBA CLASSES


Examples: getNotesFont method
This agent creates a document with a rich text item with three lines of text in different fonts.

import lotus.domino.*;

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();
     doc.appendItemValue("Form", "MainTopic");
     doc.appendItemValue("Subject", "Three fonts");
     RichTextItem rti = doc.createRichTextItem("Body");
     RichTextStyle style = session.createRichTextStyle();
     style.setFont(rti.getNotesFont("Times", true));
     rti.appendStyle(style);
     rti.appendText("This text is in Times");
     rti.addNewLine(2);
     style.setFont(rti.getNotesFont("Courier", true));
     rti.appendStyle(style);
     rti.appendText("This text is in Courier");
     rti.addNewLine(2);
     style.setFont(rti.getNotesFont("Arial", true));
     rti.appendStyle(style);
     rti.appendText("This text is in Arial");
     doc.save(true, true);

   } catch(Exception e) {
     e.printStackTrace();
   }
 }

}

See Also