1 17 18 19 20 21 27 28 package org.apache.fop.render.rtf.rtflib.testdocs; 29 30 import java.io.IOException ; 31 32 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; 33 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; 34 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; 35 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfText; 36 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; 37 38 41 42 class TextAttributes extends TestDocument { 43 44 protected void generateDocument(RtfDocumentArea rda, RtfSection sect) 45 throws IOException { 46 final RtfParagraph para = sect.newParagraph(); 47 para.newText("This is normal\n"); 48 para.newText("This is bold\n", new RtfAttributes().set(RtfText.ATTR_BOLD)); 49 para.newText("This is italic\n", new RtfAttributes().set(RtfText.ATTR_ITALIC)); 50 para.newText("This is underline\n", new RtfAttributes().set(RtfText.ATTR_UNDERLINE)); 51 52 para.newText("This is size 48\n", new RtfAttributes().set(RtfText.ATTR_FONT_SIZE, 96)); 54 55 para.newText( 56 "This is bold and italic\n", 57 new RtfAttributes().set(RtfText.ATTR_BOLD).set(RtfText.ATTR_ITALIC) 58 ); 59 60 final RtfAttributes attr = new RtfAttributes(); 61 attr.set(RtfText.ATTR_BOLD).set(RtfText.ATTR_ITALIC); 62 attr.set(RtfText.ATTR_UNDERLINE); 63 attr.set(RtfText.ATTR_FONT_SIZE, 72); 64 para.newText("This is bold, italic, underline and size 36\n", attr); 65 66 para.newText("This is back to normal\n"); 67 } 68 } | Popular Tags |