Tuesday, May 30, 2006

Callisto Webinar

The Eclipse team will be starting a series or Webinars in June focused on the Callisto release. The BIRT and DTP teams have the pleasure of doing the first on June 5. We will be focusing on DTP, BIRT, and RCP integration.

If you haven't already signed up, check out Ian's Blog or go to the Eclipse site and register.

21 comments:

Anonymous said...

Hello

Sorry for the question, but :

With the Engine, is it possible to create a .pdf with a .rptDocument ?

------
EngineConfig config = new EngineConfig(); config.setEngineHome("C:/birt-runtime-2_0_1/Report Engine");
ReportEngine engine = new ReportEngine(config);
IReportRunnable design = engine.openReportDesign("test.rptdesign");
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
FORenderOption option = new FORenderOption(); option.setOutputFileName("test.pdf"); option.setOutputFormat("pdf"); task.setRenderOption(option);
task.run();
engine.destroy();
---------

I would build a pdf with a rptDocument.

I writed that :
--------------
IReportDocument document = engine.openReportDocument("test.rptdocument");
IDataExtractionTask task = engine.createDataExtractionTask(document);
------------

But after ? Is it possible ?

Thank you very much :)

Good Bye

Anonymous said...

I have a couple of questions :

1. Is it possible to i18n the display name of parameter in the parameter dialog ? We can i18n the text fields, ... but the parameters ? :)

2. I saw in the source code several comments on "print report" and "export pdf or excel" report. (All code is Ok except the end. For example : "Print" display a javascript popup with the URL of Google lol) Will you implement this functionnality in the next version of BIRT ?

Thanks :)

Nico

Jason Weathersby said...

Here is a quick example of generating the rpt document and then using it to render to pdf.


import java.util.HashMap;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineConstants;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.HTMLRenderContext;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IRenderTask;
import org.eclipse.birt.report.engine.api.IReportDocument;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunTask;
import org.eclipse.birt.report.engine.api.ReportEngine;
public class RenderReport {
static void renderReport() throws EngineException
{
//Engine Configuration - set and get temp dir, BIRT home, Servlet context
EngineConfig config = new EngineConfig();
config.setEngineHome( "C:/birt-runtime-2_0_1/birt-runtime-2_0_1/Report Engine" );

//Create the report engine
ReportEngine engine = new ReportEngine( config );



//Open a report design - use design to modify design, retrieve embedded images etc.
IReportRunnable design = engine.openReportDesign("C:/test/Render/Pages.rptdesign");

//Create task to run the report - use the task to execute and run the report,
IRunTask rtask = engine.createRunTask(design);


//run the report and destroy the engine
rtask.run("c:/test/Render/Pages.rptdocument");


//Open a report document
IReportDocument iReportDocument = engine.openReportDocument("c:/test/Render/Pages.rptdocument");

IRenderTask task = engine.createRenderTask(iReportDocument);
System.out.println("============================== " + iReportDocument.getPageCount());


//Set Render context to handle url and image locataions
HTMLRenderContext renderContext = new HTMLRenderContext();
renderContext.setImageDirectory("image");
HashMap contextMap = new HashMap();
contextMap.put( EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext );
task.setAppContext( contextMap );

//Set Render Options
HTMLRenderOption options = new HTMLRenderOption();

//options.setOutputStream(System.out);
options.setOutputFileName("c:/test/Render/pages.pdf");
options.setOutputFormat("pdf");
task.setRenderOption(options);


//Render Pages 1-2,7
task.render("1");

task.close();

engine.destroy();
}
public static void main(String[] args) {
try
{
renderReport( );
}
catch ( Exception e )
{
e.printStackTrace();
}
}
}

Jason Weathersby said...

In previous code I believe you can just use a RenderOptionsBase class instead of the HTMLRenderOption.

1 - If you select the parameter and then look at the property editor, you will see an entry for localization. You should be able to put your key there.

2 - I believe the Print icon will be added back in BIRT 2.1.

Anonymous said...

Thank you very much for your answer :)
All is ok except the localization of the parameter :( In the properties, I see only a key for the tool tip :(
But it is not very important, I will apply another solution for my integration of BIRT in my application :)

Thanks again :)

Nico

Liviu said...

Hello,

Is there any chance I cand get my hands on the sources used for the presentation you held on June the 5th on BIRT/DTP/RCP ?

Thank you very much,
Liviu

Jason Weathersby said...

These are now posted on the DTP site.

Jason

Anonymous said...

hi...
i want to know how the birt report objects are internally represented in the java code....as in if i want to read the data form the BIRT report and display it on the console...
i would be grateful if u can help with some code snippets or methods..
--
Thanx and Regards,
Priyanka.

P_desh said...

hi...
i want to know how the birt report objects are internally represented in the java code....as in if i want to read the data form the BIRT report and display it on the console...
i would be grateful if u can help with some code snippets or methods..
--
Thanx and Regards,
Priyanka.

Jason Weathersby said...

Take a look at the org.eclipse.birt.report.model project. This project contains the element types. You should be able to add to your project for debugging purposes.

Anonymous said...

Hi
I've a problem when I want to display my *.rptdesign with de preview Eclipse option.
I've made a design with a table and a bar chart. When I try to display it I only see the table.
I've tried with several examples and the result is the same. I can't preview the design avec the preview Eclipse option.
I don't have any Exception and the data source and data set has no problem (because I can see the table), so I've thought the error can be at the Java Build Path configuration.

Can you tell me which .*jar I must put there to display my design??

Please I need to sort out this problem as soon as posible.
Or if you have other idea that can help me....

THANKS.

Jason Weathersby said...

If you are just using the designer, you should not have to do anything special for previewing a chart. Is your chart output type set to SVG? If so try BMP/PNG/JPG.

Jason

Anonymous said...

Thank you
I've added org.eclipse.birt.chart.engine to my project and now I can see the designs at the web page, but only if they are made with the interface. If I try to see my own design (made with java) at the web page I can't see it.
I enabled the "Enable SVG chart" option (Window/Preferences/Report Desing/Prewiew), but it isn't the solution...
Can you tell me how to change the image output format? I can't find the function I must use...
Can you help me?
Thanks!

Anonymous said...

Hi, I've tried changing the output format, but it isn't the solution...
I've read that org.eclipse.birt.core is used, but if I add it at the Java Build Path I've a NullPointerException at the line 'engine = factory.createDesignEngine( config );' because factory is null. If org.eclipse.birt.core isn't at the Java Build Path factory isn't null...
How I can do?
Other ideas???
Thanks

Jason Weathersby said...

The only libs you need in the build path are the ones in the Runtime download. Specifically the ReportEngine/lib directory. You need to set BIRT_HOME to locate the rest of the BIRT plugins. Send me an email with you code if you would like me to look into it.

Jason

Anonymous said...

Ok, Jason
I've sent an email with my code.
That's what I've done. I've put in the build path the packages at the ReportEngine/lib folder and reportItem jar.
I've installed:
birt-report-designer-all-in-one-2.1.2
birt-runtime-2.1.2
birt-charts-2.1.2
birt-sample-plugins-2.1.2

My Java Build Path is like this (without ".jar" et the version number):

chartengineapi
com.ibm.icu
commons-cli
commons-codec
coreapi
dataadapterapi
dteapi
engineapi
flute
iText1.3
iTextAsian
js
modelapi
org.eclipse.birt.chart.device.extension
org.eclipse.birt.chart.device.pdf
org.eclipse.birt.chart.device.svg
org.eclipse.birt.chart.device.swt
org.eclipse.birt.chart.engine
org.eclipse.birt.chart.engine.extension
org.eclipse.birt.chart.reportitem
org.eclipse.emf.common
org.eclipse.emf.ecore
org.eclipse.emf.ecore.xmi
sac
scriptapi
servlet

That's right?
Thanks

Anonymous said...

Hi,
I've tried with the code que you've said and it works.
Now I would like to make the design and generate the HTML page within the same project, but I get the Exception below:
Plug-in org.eclipse.birt.chart.reportitem was unable to load class org.eclipse.birt.chart.reportitem.ChartReportItemGenerationImpl.

How can I solve it??
Thanks

Jason Weathersby said...

Send me the code you are using to run the report.

Jason

Anonymous said...

Hi,
I have a chart whith department's number on the X axes and sales on the Y axes. The problem comes when I display the report because the department's numbers has decimals

I tried with:
NumberFormatSpecifier nfs = NumberFormatSpecifierImpl.create( );
nfs.setFractionDigits( 0 );
...
xAxisPrimary.setFormatSpecifier( nfs );

And I after that I tried whith:
xAxisPrimary.setType(AxisType.LINEAR_LITERAL);
but this line returns an exception when I display the report:
The following items have errors:

Chart (id = 25):
+ Bars may not be rendered on a value scale

exception.xvalue.scale.bars ( 1 time(s) )
detail : org.eclipse.birt.chart.exception.ChartException: Bars may not be rendered on a value scale
at org.eclipse.birt.chart.render.Bar.renderSeries(Bar.java:159)
at org.eclipse.birt.chart.render.AxesRenderer.renderPlot(AxesRenderer.java:2256)
at org.eclipse.birt.chart.render.AxesRenderer.render(AxesRenderer.java:303)
at org.eclipse.birt.chart.factory.Generator.render(Generator.java:1231)
at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationImpl.onRowSets(ChartReportItemPresentationImpl.java:471)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.processExtendedContent(LocalizedContentVisitor.java:653)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.visitForeign(LocalizedContentVisitor.java:359)
at org.eclipse.birt.report.engine.content.impl.ForeignContent.accept(ForeignContent.java:58)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localize(LocalizedContentVisitor.java:111)
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:38)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildren(HTMLBlockStackingLM.java:63)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:159)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:94)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutChildren(HTMLInlineStackingLM.java:138)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:159)
at org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout(HTMLRowLM.java:30)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildren(HTMLBlockStackingLM.java:68)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:74)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:159)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layoutChildren(HTMLPageLM.java:139)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:81)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:85)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:205)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:142)
at CreateReport.runDesign(CreateReport.java:78)
at ReportGenerator.doGet(ReportGenerator.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:619)

Please, how should I configure X Axis???

Jason Weathersby said...

Have you tried setting the x axis to TEXT_LITERAL?

Jason

Anonymous said...

Can BIRT output a file with PCL code?