1 17 18 19 20 21 27 28 package org.apache.fop.render.rtf.rtflib.rtfdoc; 29 30 import java.io.IOException ; 31 32 36 37 public class RtfTemplate { 38 39 40 private static RtfTemplate instance = null; 41 42 private String templateFilePath = null; 43 44 47 private RtfTemplate () { 48 49 } 50 51 52 57 public static RtfTemplate getInstance () { 58 if (instance == null) { 59 instance = new RtfTemplate(); 60 } 61 62 return instance; 63 } 64 65 66 71 public void setTemplateFilePath(String templateFilePath) throws IOException { 72 if (templateFilePath == null) { 74 this.templateFilePath = null; 75 } else { 76 this.templateFilePath = templateFilePath.trim(); 77 } 78 } 79 80 85 public void writeTemplate (RtfHeader header) throws IOException { 86 if (templateFilePath == null || templateFilePath.length() == 0) { 87 return; 88 } 89 90 header.writeGroupMark (true); 91 header.writeControlWord ("template"); 92 header.writeRtfString(this.templateFilePath); 93 header.writeGroupMark (false); 94 95 header.writeGroupMark (true); 96 header.writeControlWord ("linkstyles"); 97 header.writeGroupMark (false); 98 } 99 } 100 101 102 | Popular Tags |