Home
Analytics
RTF output
fastcars
I cannot find any API examples of RTF output, and RTF is not an option in the RenderOption class. What I mean is how do I call Birt from java passing a template and xml data , and get the generated report in RTF format.
Does anyone have an example of how this is done ?
Will save me downloading the Birt designer source code to work it out.
Out if interest does it use the Tribix emitters or built in ones?
Find more posts tagged with
Comments
mwilliams
Hi fastcars,<br />
<br />
There is no RTF output built into BIRT. Tribix does have an RTF emitter for BIRT. If you felt up for it, you could write your own emitter as the emitter layer has extension points. Here's a post from the devShare that will link you to the Tribix emitters.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/devshare/designing-birt-reports/33-tribix-extended-emitters-for-birt/#description'>Tribix
- Extended Emitters for BIRT - Designs & Code - BIRT Exchange</a>
Mr.Reed
Hi there,<br />
<br />
i use Birt 3.7.0 and the report engine, to generate reports in java web-and swing-application. For now i generated pdfs, but also want to generate rtf-documents and then merge them.<br />
<br />
I downloaded and tried the Tribix too, but it doesn't seem to be compatible with Birt 3.7.0 (i get some Nullpointer in class Rtfwriter).<br />
<br />
But some common questions:<br />
1.) When generating a report with the options<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>options = new RenderOption();
options.setOutputFormat("doc");</pre>
i can save that document as a rtf on disk, for example. When i open the rtf-file the content is there. So i generated a Word-Document, but saved it as RTF, what luckilly works, because word opens rtf?<br />
<br />
2.) When generating more than just one rtf's with birt (as explained above) and trying to merge them with the following code<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>Document rtfDoc = new Document();
RtfWriter2 rtfwriter2 = RtfWriter2.getInstance(rtfDoc, new FileOutputStream("D:/testi.rtf"));
rtfDoc.open();
for (String rtfFile : rtfFiles) { // rtffiles is a list of pathes to the generated rtf-files
FileInputStream fis = new FileInputStream(new File(rtfFile));
rtfwriter2.importRtfDocument(fis);
}
rtfwriter2.flush();
rtfDoc.close();</pre>
<br />
the file testi.rtf is generated but without any contents. So the merge doesn't seem to work at this point. May this be because the output-format of the birt-run-and-render-task is actually a word, so the RtfWriter2 can't interprete that?<br />
<br />
I am running out of ideas how to merge rtf-files. And Tribix may could have worked, but is obviously not compatible with Birt 3.7.0.<br />
Are there meanwhile other possibilities of generating rtf-reports and merge them?<br />
<br />
Thanks in advance.
mwilliams
Tribix hasn't been updated since 2.5, I don't believe. I'm pretty sure you have access to the source for the Tribix emitters, so you could look at the code and see if there is something obvious that would cause it to not work in 3.7.