Trace: • Using Raw Values
If you're creating RTF reports with RtfWorker, it's sometimes useful to directly write RTF syntax. This can be useful if you need a feature which it's not already implemented. Such a raw value can help you in that case.
Here's a short example which creates a simple checkbox with Wingdings font:
Bean bean = new Bean(); bean.put("CHECKBOX", new RawStringValue("{\\field{\\*\\fldinst SYMBOL 254 \\\\f \"Wingdings\" \\\\s 11}{\\fldrslt\\f10\\fs22}}")); BeanNode node = new BeanNode(bean); RtfWorker w = new RtfWorker(); w.loadDocument(getTemplateInputStream("rawvalues.rtf")); w.fillInData(node); w.saveDocument(new FileOutputStream(getTempOutputFile("result_rawvalues.rtf")));
The template only contains:
[CHECKBOX]