Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Saving report output in DB
Saving report output in DB [message #905648] Thu, 30 August 2012 20:03
Madhav Suram is currently offline Madhav SuramFriend
Messages: 10
Registered: August 2011
Junior Member
I saw a couple of entries in the forum including an enhancement/bug request at https://bugs.eclipse.org/bugs/show_bug.cgi?id=366806. But didn't find any solution at the moment.

We have a requirement to generate the report and store it in a DB and download the report at a later date for viewing.

IReportRunnable design;
ByteArrayOutputStream byteStream=new ByteArrayOutputStream();

// Open report design file
InputStream designFileAsInputStream = getDesignAsStream(reportFileName);
design = birtEngine.openReportDesign(designFileAsInputStream);
// create task to run and render report
IRunAndRenderTask task = birtEngine.createRunAndRenderTask(design);	
setReportParameters(task, taskProps);
task.validateParameters();

// set output options
HTMLRenderOption options = new HTMLRenderOption();			
options.setOutputFormat(format);			//HTML, PDF, PPT or XLS
options.setOutputStream(byteStream);

task.setRenderOption(options);
task.run();		

Connection dbConn = getDBConn();			//Get DB connection from connection pool	
String insertReportSQL = "insert into birt.REPORTS (PRIKEY,DOC,DOCFORMAT,REPORTNAME) values(?,?,?,?,?)";
PreparedStatement st = dbConn.prepareStatement(insertReportSQL);

st.setString(1,PRIKEY);						
st.setObject(2, byteStream.toByteArray());	//REPORT
st.setString(3, format);			//Report Format
st.setString(4, reportFileName);				
rs = st.executeUpdate();

dbConn.close();


The above code works fine for PDF, PPT and XLS format reports as all images and content are in one file and we can retrieve the same too from DB. But the issue for HTML is that the images used within the report are stored in temporary location and the "byteStream", used above, only has the html content.

Is there a way to generate a mht format file instead so all images are also embedded within the document and can be saved and downloaded? Or some other way the HTML version of the report can be saved?

Thanks & Regards,
Madhav

[Updated on: Thu, 30 August 2012 20:16]

Report message to a moderator

Previous Topic:BIRT 2.6.1 Rhino java script support Question
Next Topic:org.eclipse.birt.report.service.api.ReportServiceException
Goto Forum:
  


Current Time: Thu Mar 28 10:57:51 GMT 2024

Powered by FUDForum. Page generated in 0.05019 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top