LwgDocument document = new LwgDocument();
RtfWriter2 writer = RtfWriter2.getInstance(document, new FileOutputStream("ExtendingStylesheets.rtf"));
// Create the new RtfParagraphStyle. The second parameter is the name of
// the RtfParagraphStyle that this style will inherit default properties from.
RtfParagraphStyle incorrectStyle = new RtfParagraphStyle("Incorrect", "Normal");
// Change the desired properties
incorrectStyle.setColor(Color.RED);
incorrectStyle.setStyle(LwgFont.STRIKETHRU);
// Register the new paragraph stylesheet with the RtfWriter2.
writer.getDocumentSettings().registerParagraphStyle(incorrectStyle);
// Create a new RtfParagraphStyle that does not inherit from any other style.
RtfParagraphStyle correctStyle = new RtfParagraphStyle("Correct", "Arial",
12, LwgFont.NORMAL, Color.GREEN);
// Register the new paragraph stylesheet with the RtfWriter2.
writer.getDocumentSettings().registerParagraphStyle(correctStyle);
// Change the default font name. This will propagate to the paragraph stylesheet