RTF 模板引擎 RTFTemplate
openkk
13年前
<p><a id="bannerLeft" href="/misc/goto?guid=4959498282042813028"><img alt="RTF 模板引擎 RTFTemplate" src="https://simg.open-open.com/show/870e8c8f454d7413f038ab8b3d396ee6.png" width="217" height="81" /> </a><br /> RTFTemplate 是一个用来生成 RTF 文档的 Java 模板引擎。</p> <p>RTFTemplate 的体系结构</p> <p><img alt="RTF 模板引擎 RTFTemplate" src="https://simg.open-open.com/show/0db0376370e27952451a1916e1cfe930.png" width="555" height="477" /></p> <p>示例代码:</p> <pre class="brush:java; toolbar: true; auto-links: false;"> public class RTFProjectTest extends AbstractUseCase { protected void putContext(IContext context) { /** * Context of simply POJO */ context.put("date", new Date()); context.put("project", new Project("Jakarta Velocity")); /** * Context of list of POJO */ List developers = new ArrayList(); Developer developer = new Developer("Will Glass-Husain", "wglass@apache.org"); developer.addRole("Java Developer"); developer.addRole("Release Manager"); .... context.put("developers", developers ); } public static void main( String[] args ) throws Exception { RTFProjectTest usecase = new RTFProjectTest(); usecase.run("usecases/project/project_model.rtf"); usecase.saveRTFVelocity(true); // Save RTF file with velocity macro // Display the XML fields System.out.println(usecase.getXMLFields()); // Save XML fields into project_model.fields.xml file with update description usecase.saveTransformedDocument("usecases/project/project_model.fields.xml" ,false); } } </pre> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1322968120171" target="_blank">http://www.open-open.com/lib/view/home/1322968120171</a></p> <p></p>