Skip to main content



      Home
Home » Archived » BIRT » Need help regarding setting HtmlRenderContext for report engine
Need help regarding setting HtmlRenderContext for report engine [message #106150] Mon, 09 January 2006 07:17 Go to next message
Eclipse UserFriend
hi all,
Iam using birt reporting engine 2.0M3 for generating reports in my web
app.
I have specified image directory in my server. In birt 1.01 iam using
IRunandRenderTask class. In this class iam using setRenderOption method as
HtmlRenderContext as argument. But in birt 2.0 M3 setRenderOption method
is asking for IRenderOption argument. please help me hoe to set
renderoption in IRunandRenderTask class.
// Here is my code
private IRunAndRenderTask task = null;
ReportEngine engine = new ReportEngine( config );
task = engine.createRunAndRenderTask( report );
HTMLRenderContext renderContext = new HTMLRenderContext( );
renderContext.setImageDirectory("./images");
renderContext.setBaseImageURL("./images");
task.setContext(renderContext);

Thanks in advance,

Regards,
Bhaskar
Re: Need help regarding setting HtmlRenderContext for report engine [message #106454 is a reply to message #106150] Mon, 09 January 2006 21:25 Go to previous message
Eclipse UserFriend
This is a multipart message in MIME format.
--=_alternative 000D5556852570F2_=
Content-Type: text/plain; charset="US-ASCII"

This should work:

// set report render options
IRenderOption options;
if ( format.equalsIgnoreCase( "pdf" ) )
{
options = new FORenderOption( );
}
else if ( format.equalsIgnoreCase( "fo" ) )
{
options = new FORenderOption( );
}
else
{
options = new HTMLRenderOption( );
if ( htmlType == "ReportletNoCSS" )
{
( (HTMLRenderOption) options
).setEmbeddable( true );
}
}

// set the output format
options.setOutputFormat( format );

// setup the output encoding
options.getOutputSetting( ).put(
HTMLRenderOption.URL_ENCODING,
encoding );

// set the render options
task.setRenderOption( options );


Notice you create different options depending on the rendering format you
want.

If you are still unsure what to do I suggest you look at the
org.eclipse.birt.report.engine.api.ReportRunner code in cvs. It's under
the source/org.eclipse.birt.report.engine module in the /home/birt
repository.
-Sheldon
--=_alternative 000D5556852570F2_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">This should work:</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // set
report render options</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IRenderOption
options;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( format.equalsIgnoreCase(
&quot;pdf&quot; ) )</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; options = new FORenderOption( );</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if
( format.equalsIgnoreCase( &quot;fo&quot; ) )</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; options = new FORenderOption( );</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; options = new HTMLRenderOption( );</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; if ( htmlType == &quot;ReportletNoCSS&quot;
)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; {</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ( (HTMLRenderOption)
options ).setEmbeddable( true );</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; }</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // set
the output format</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; options.setOutputFormat(
format );</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // setup
the output encoding</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; options.getOutputSetting(
).put( HTMLRenderOption.URL_ENCODING,</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; encoding
);</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // set
the render options</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; task.setRenderOption(
options );</font>
<br>
<br>
<br><font size=2 face="sans-serif">Notice you create different options
depending on the rendering format you want.</font>
<br>
<br><font size=2 face="sans-serif">If you are still unsure what to do I
suggest you look at the org.eclipse.birt.report.engine.api.ReportRunner
code in cvs. &nbsp; It's under the source/org.eclipse.birt.report.engine
module in the /home/birt repository. &nbsp;</font>
<br><font size=2 face="sans-serif">-Sheldon</font>
--=_alternative 000D5556852570F2_=--
Previous Topic:Any suggestions on how to implement this groupby?
Next Topic:need help installing Birt
Goto Forum:
  


Current Time: Fri Jul 18 13:02:40 EDT 2025

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

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

Back to the top