| Render while report is generated [message #791333] |
Sun, 05 February 2012 12:10  |
harip kaligo Messages: 74 Registered: July 2011 |
Member |
|
|
Hi,
We need to render report while report is being generated. For example, we have some 100 pages of report and first three pages are rendered, we need to display the three pages rendered and the rest as they are rendered. We need this as the customer need not wait for the entire report to be rendered.
we are using report tag to display the rptdocument.We also use run and then render options to generate reports.
Environment:
Jdk:1.5
BIRT3.7
Weblogic 10.0.2
Any ideas or sample program on how to implement this would be of great help.
Also, what does task.enableProgressiveViewing() does?
Thanks,
KKP
[Updated on: Mon, 06 February 2012 06:19] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
| Re: Render while report is generated [message #957626 is a reply to message #791333] |
Thu, 25 October 2012 07:17   |
Saurabh Puri Messages: 10 Registered: February 2012 |
Junior Member |
|
|
Hi..
I am trying to display the report on report viewer and at the same time i am trying to render the report as pdf to save automatically to a folder on server....
My report extends to multiple pages and the problem is that when i press next button on Birtviewer, it renders again to create another copy of pdf. (so if my report has 10 pages, it creates 10 copies of same report in pdf in that folder)
I tried setting a global variable which i can use in the if condition to run the beforerender() code once, but somehow it doesnt seem to be working fine.
Please let me know the way out of this.
This is the code i am using to render as pdf (placed under beforeRender function)
if(reportContext.getPersistentGlobalVariable('g_var').equals("1"))
{
reportContext.setPersistentGlobalVariable("g_var","2");
mmap = reportContext.getHttpServletRequest().getAttribute("attributeBean").getModuleOptions();
rptdoc = reportContext.getHttpServletRequest().getAttribute("attributeBean").getReportDocumentName();
importPackage(Packages.org.eclipse.birt.report.engine.api);
importPackage(Packages.java.io)
var re = reportContext.getReportRunnable().getReportEngine();
var mdocument = re.openReportDocument(null,rptdoc, mmap);
var options = new PDFRenderOption();
baos = new ByteArrayOutputStream();
options.setOutputFormat("pdf");
options.setOutputStream(baos);
var ntask = re.createRenderTask(mdocument);
ntask.setRenderOption(options);
ntask.render();
ntask.close();
mdocument.close();
str = "blabla";
success1 = (new File("../webapps/ReportGen/BIRTReports")).mkdir(); //create directory
var path = "myreport_" + str;
fout = new FileOutputStream("../webapps/ReportGen/BIRTReports/"+path); //This name needs to be dynamic
fout.write(baos.toByteArray());
fout.flush();
fout.close();
//g_var = "2";
}
Thanks
[Updated on: Thu, 25 October 2012 07:18] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04303 seconds