1 17 18 19 20 21 27 28 package org.apache.fop.render.rtf.rtflib.testdocs; 29 30 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; 31 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; 32 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; 33 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfText; 34 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; 35 36 39 public class ParagraphAlignment extends TestDocument { 40 41 44 public ParagraphAlignment() { 45 } 46 47 53 protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws java.io.IOException 54 { 55 RtfAttributes attr = new RtfAttributes (); 56 attr.set(RtfText.ALIGN_CENTER); 57 RtfParagraph p = sect.newParagraph (attr); 58 p.newLineBreak(); 59 p.newLineBreak(); 60 p.newText ("Centered title"); 61 p.newLineBreak(); 62 p.close(); 63 64 attr = new RtfAttributes (); 65 attr.set(RtfText.ALIGN_LEFT); 66 p = sect.newParagraph (attr); 67 p.newLineBreak(); 68 p.newText ("This is the left aligned text."); 69 p.newLineBreak(); 70 p.close(); 71 72 attr = new RtfAttributes (); 73 attr.set(RtfText.ALIGN_RIGHT); 74 p = sect.newParagraph (attr); 75 p.newLineBreak(); 76 p.newText ("This is the right aligned text."); 77 p.newLineBreak(); 78 p.close(); 79 } 80 } 81 | Popular Tags |