Example: RGB method

This example sets a red background color for the paragraph.

 try {
  Application application = Application.getInstance();
  Documents documents = application.getDocuments();
  Document document = documents.openDocument("D:\\test.odt", true);
  TextParagraph paragraph = document.getParagraphs().item(1);
  paragraph.setBackTransparent(false);
  paragraph.setBackgroundColor(application.RGB(255, 0, 0));
 } catch(Exception e) {
   e.printStackTrace();
 }

Related information

RGB method