Skip to main content



      Home
Home » Archived » BIRT » Diplaying image or chart report in JSP or HTML
Diplaying image or chart report in JSP or HTML [message #116996] Thu, 26 January 2006 02:18 Go to next message
Eclipse UserFriend
Originally posted by: sri.gmail.com

hi

i am trying to diaply image or chart report which is designed using birt
report designer.

i used following code to generate HTML output

EngineConfig config = new EngineConfig( );
config.setEngineHome( "E:\\birt" );
HTMLEmitterConfig hc = new HTMLEmitterConfig( );
HTMLCompleteImageHandler imageHandler = new HTMLCompleteImageHandler( );
hc.setImageHandler( imageHandler );
config.setEmitterConfiguration( HTMLRenderOption.OUTPUT_FORMAT_HTML, hc );
ReportEngine engine = new ReportEngine( config );
IReportRunnable report = null;
try{
report = engine.openReportDesign( name );
}catch ( EngineException e ){
System.err.println( "Report " + name + " not found!\n" );
engine.destroy( );
return;
}

if ( showInfo ) {
showReportInfo( engine, report );
}

if ( format != null ){
parseParams( engine, report, params );
IRunAndRenderTask task = engine.createRunAndRenderTask( report );
HTMLRenderOption options = new HTMLRenderOption( );
options.setOutputFormat( format );
String output = name.replaceFirst( ".rptdesign", "." + format );
options.setOutputFileName( output );
task.setRenderOption( options );
task.setParameterValues( params );

try{
task.run( );
}
catch ( EngineException e1 ) {
System.err.println( "Report " + name + " run failed.\n" );
System.err.println( e1.toString( ) );
}
}

engine.destroy( );
}



This code is working fine with Simple reports which contain Tables but its
not working fine with reports which contain images or charts

this code is generating .html file for image reports but image is not
printing.

and aslo i am not clear with the following comments
// HTML reports can have embedded images or charts. Set up the
configuration
// required to write these into a directory in the output directory.
// The HTMLCompleteImageHandler is one provided by BIRT for this purpose.
// Your application can create a customized version to provide alternative
// ways to handle images.



Soultion is very URGENT PLEASE HELP ME REGARDING THIS

SRI
Re: Diplaying image or chart report in JSP or HTML [message #117300 is a reply to message #116996] Thu, 26 January 2006 06:43 Go to previous messageGo to next message
Eclipse UserFriend
sri,

Try

HTMLRenderContext renderContext = new HTMLRenderContext();
renderContext.setImageDirectory("image");
HashMap contextMap = new HashMap();
contextMap.put( HTMLRenderContext.CONTEXT_NAME, renderContext );
task.setContext( contextMap );

right before

HTMLRenderOption options = new HTMLRenderOption( );

Jason Weathersby
BIRT PMC


"sri" <sri@gmail.com> wrote in message
news:3d827dd4068b74c15a3791b38c0e80ae$1@www.eclipse.org...
> hi
> i am trying to diaply image or chart report which is designed using birt
> report designer.
> i used following code to generate HTML output
> EngineConfig config = new EngineConfig( );
> config.setEngineHome( "E:\\birt" );
> HTMLEmitterConfig hc = new HTMLEmitterConfig( );
> HTMLCompleteImageHandler imageHandler = new HTMLCompleteImageHandler( );
> hc.setImageHandler( imageHandler );
> config.setEmitterConfiguration( HTMLRenderOption.OUTPUT_FORMAT_HTML, hc );
> ReportEngine engine = new ReportEngine( config );
> IReportRunnable report = null;
> try{
> report = engine.openReportDesign( name );
> }catch ( EngineException e ){
> System.err.println( "Report " + name + " not found!\n" );
> engine.destroy( );
> return;
> }
>
> if ( showInfo ) {
> showReportInfo( engine, report );
> }
>
> if ( format != null ){
> parseParams( engine, report, params );
> IRunAndRenderTask task = engine.createRunAndRenderTask( report );
> HTMLRenderOption options = new HTMLRenderOption( );
> options.setOutputFormat( format );
> String output = name.replaceFirst( ".rptdesign", "." + format );
> options.setOutputFileName( output );
> task.setRenderOption( options );
> task.setParameterValues( params );
>
> try{
> task.run( );
> }
> catch ( EngineException e1 ) {
> System.err.println( "Report " + name + " run failed.\n" );
> System.err.println( e1.toString( ) );
> }
> }
>
> engine.destroy( );
> }
>
>
>
> This code is working fine with Simple reports which contain Tables but its
> not working fine with reports which contain images or charts
>
> this code is generating .html file for image reports but image is not
> printing.
> and aslo i am not clear with the following comments
> // HTML reports can have embedded images or charts. Set up the
> configuration
> // required to write these into a directory in the output directory.
> // The HTMLCompleteImageHandler is one provided by BIRT for this purpose.
> // Your application can create a customized version to provide alternative
> // ways to handle images.
>
>
>
> Soultion is very URGENT PLEASE HELP ME REGARDING THIS
>
> SRI
>
Re: Diplaying image or chart report in JSP or HTML [message #117418 is a reply to message #117300] Thu, 26 January 2006 07:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sri.gmail.com

hi thanks for u r reply
but i have ask one thing in this code


HTMLRenderContext renderContext = new HTMLRenderContext();
renderContext.setImageDirectory("image");
HashMap contextMap = new HashMap();
contextMap.put( HTMLRenderContext.CONTEXT_NAME, renderContext );
task.setContext( contextMap );



contextMap.put( HTMLRenderContext.CONTEXT_NAME, renderContext );

i searched in the HTMLTenderContext for the final varible CONTEXT_NAME
BUT ITS not there in both birt 1.0.1 and 2.0.0

so can u hlep me regarding this

HTMLRenderContext.CONTEXT_NAME wether its a String or final varibale of
HTMLRenderContext class

Solution is Urgent....
please help me

sri
Re: Diplaying image or chart report in JSP or HTML [message #117430 is a reply to message #117418] Thu, 26 January 2006 07:54 Go to previous messageGo to next message
Eclipse UserFriend
sri,

Sorry wrong snippet

from ReportRunner.java

if ( format.equalsIgnoreCase( "html" ) )
{
HTMLRenderContext renderContext = new HTMLRenderContext( );
renderContext.setImageDirectory( "image" ); //$NON-NLS-1$

HashMap appContext = new HashMap( );
appContext.put( EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
renderContext );
task.setAppContext( appContext );
}

Jason

"sri" <sri@gmail.com> wrote in message
news:85bb56b969eef8e66980d0735f142d75$1@www.eclipse.org...
> hi thanks for u r reply
> but i have ask one thing in this code
>
>
> HTMLRenderContext renderContext = new HTMLRenderContext();
> renderContext.setImageDirectory("image");
> HashMap contextMap = new HashMap();
> contextMap.put( HTMLRenderContext.CONTEXT_NAME, renderContext );
> task.setContext( contextMap );
>
>
>
> contextMap.put( HTMLRenderContext.CONTEXT_NAME, renderContext );
>
> i searched in the HTMLTenderContext for the final varible CONTEXT_NAME
> BUT ITS not there in both birt 1.0.1 and 2.0.0
> so can u hlep me regarding this
>
> HTMLRenderContext.CONTEXT_NAME wether its a String or final varibale of
> HTMLRenderContext class
>
> Solution is Urgent....
> please help me
> sri
>
Re: Diplaying image or chart report in JSP or HTML [message #118321 is a reply to message #117430] Thu, 26 January 2006 22:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sri.gmail.com

hi Jason

could u send me a java program which can display both images/chars and
table reports . i asking about hole program.

solution is urgent

regards
sri
Re: Diplaying image or chart report in JSP or HTML [message #119224 is a reply to message #118321] Fri, 27 January 2006 16:14 Go to previous message
Eclipse UserFriend
sri,

Did you look at this program?
http://www.eclipse.org/birt/phoenix/deploy/ReportRunner.java

Jason

"sri" <sri@gmail.com> wrote in message
news:d62963e49d5c3bb2f6ef28041cabb6b5$1@www.eclipse.org...
> hi Jason
>
> could u send me a java program which can display both images/chars and
> table reports . i asking about hole program.
>
> solution is urgent
>
> regards
> sri
>
Previous Topic:Need help regarding specifying database usename and password in template(URGENT)
Next Topic:Issue regarding report engine
Goto Forum:
  


Current Time: Thu May 29 03:32:08 EDT 2025

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

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

Back to the top