Hi,

I already wrote to you in private and didn't noticed you were also
posting to the list... Here is the transcript of my last two private e-mails

.............

You have to download the BIRT runtime from

http://download.eclipse.org/birt/downloads/

This is what you have to deploy with your WEB application.  The 
runtime  is like an eclipse (an equinox OSGi runtime) but stripped of
all the GUI thing and containing just the minimal functionality to
execute BIRT reports: the designer but without the design part. That way
the footprint is small as you have to distribute it with your WEB
application.  The code I showed you on the list was to instantiate this
runtime from within your WEB application. Then you use that runtime to
build your reports. In my experience, it is better if this runtime is
the same version as the designer you used to build your reports
(otherwise you might find unpleasant surprises).

newbieabc wrote:
> Thank you for your reply...
> I am sorry to sound redundant...
> I had started off by downloading the birt-all-in-one (came bundled with the
> full Eclipse SDK).
> Created a maven project( wicket quickstart) , then designed the birt
> rptdesign (all within the eclipse platform) I run it outside eclipse, (mvn
> jetty:run)
>
> Now, I have downloaded the birt runtime engine, and copied files from the
> birtrunttime\ReportEngine\plugins to the eclipse\plugins
>
> But when I try to use "org.eclipse.birt.report.engine.api.ReportEngine" i
> get "org.eclipse cannot be resolved"
>
>   
This error is because you have to copy some of the jar files on
runtime/plugins to your classpath (and/or the WEB-INF/lib folder
depending on how you setup your project). I have the following:

/WEB-INF/lib/birt-chartengineapi-2.3.jar
/WEB-INF/lib/birt-com.ibm.icu_3.8.1.v20080530.jar
/WEB-INF/lib/birt-coreapi-2.3.jar
/WEB-INF/lib/birt-crosstabcoreapi-2.3.jar
/WEB-INF/lib/birt-dataadapterapi-2.3.jar
/WEB-INF/lib/birt-dataaggregationapi-2.3.jar
/WEB-INF/lib/birt-dteapi-2.3.jar
/WEB-INF/lib/birt-emitter.prototype.excel_2.3.0.v20080606.jar
/WEB-INF/lib/birt-engineapi-2.3.jar
/WEB-INF/lib/birt-flute-2.3.jar
/WEB-INF/lib/birt-js-2.3.jar
/WEB-INF/lib/birt-modelapi-2.3.jar
/WEB-INF/lib/birt-modelodaapi-2.3.jar
/WEB-INF/lib/birt-odadesignapi-2.3.jar
/WEB-INF/lib/birt-org.apache. commons.codec_1.3.0.v20080530-1600.jar
/WEB-INF/lib/birt-org.eclipse.birt.report.engine.dataextraction_2.3.0.v20080611.jar
/WEB-INF/lib/birt-org.eclipse.emf.common_2.4.0.v200806091234.jar
/WEB-INF/lib/birt-org.eclipse.emf.ecore_2.4.0.v200806091234.jar
/WEB-INF/lib/birt-org.eclipse.emf.ecore.xmi_2.4.0.v200806091234.jar
/WEB-INF/lib/birt-org.w3c.css.sac_1.3.0.v200805290154.jar
/WEB-INF/lib/birt-scriptapi-2.3.jar

But maybe I'm missing in this list some related  jars... Some of the
jars on previous list have shortened names, not the names they have on
the runtime/plugins folder, but I guess you will have no problems in
finding them. If you don't add these jars then your IDE (eclipse?) won't
be able to compile the "Birt" class of my first e-mail. Once the class
compiles then try something simple (like building a hello world report).

I forgot to mention this on my previous e-mails...

Best,

Ernesto

> Not sure what I should do for this.
> Thank you for your help..and again sorry to sound redundant, I am really new
> to this.
>
>
> reiern70 wrote:
>   
>> Hi,
>>
>> For the BIRT part you need to install somewhere a BIRT runtime.
>> Essentially, this an equinox OSGi runtime with a folder structure like:
>>
>> {root}-configuration`
>>          -plugins
>>
>> If you have extended BIRT by adding your own ODA extensions then you have
>> to drop them on the plugins folder. There is also a folder (e.g.
>> plugins/org.eclipse.birt.report.data.oda.jdbc_2.3.0.v20080610/drivers)
>> where you have to drop any JDBC drivers you need to connect to your
>> database (in case you are using standard ODA drivers). I usually install
>> the BIRT runtime under WEB-INF...
>>
>> The next step is to have instantiate this runtime and use it to generate
>> your reports. I do this via a class like the following:
>>
>>
>> public class Birt {
>>      
>>         .............
>>
>>         private static IReportEngine engine;
>>
>>
>>      public static final void startEngine() {
>>              try {
>>                      if(engine != null)
>>                              return;
>>                      
>>                      EngineConfig engCnf = new EngineConfig();               
>>         
>>              
>> engCnf.setEngineHome(ConfigGlobal.i.resuelveRuta("WEB-INF/birt").toString());
>>                      
>> engCnf.setLogConfig(ConfigGlobal.i.resuelveRuta("../logs").toString(),
>> Level.ALL);                  
>>                      Platform.startup(engCnf);
>>                      IReportEngineFactory factory = (IReportEngineFactory) 
>> Platform
>>                              .createFactoryObject(
>> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
>>                      engine = factory.createReportEngine(engCnf);
>>                      engine.changeLogLevel( Level.OFF );                     
>>                         
>>              } catch (Throwable ex) {
>>                      log.fatal("", ex);
>>              }
>>      }
>>      
>>      public static final void stopEngine() {
>>              try {
>>                      engine.destroy();
>>                      engine = null;
>>              } catch (Exception e) {
>>              }
>>      }
>>      
>>      public static IReportEngine getEngine() {
>>              if(engine == null) {
>>                      startEngine();
>>              }
>>              return engine;
>>      }
>>  
>>
>>         public static void generateBirtReport(String file, 
>>                      String fmt, 
>>                      OutputStream out, 
>>                      IdSql area, 
>>                      ReportInfo petA, 
>>                      JSONObject parametros_Reporte, Locale locale, boolean 
>> autoPageBreaking)
>> throws Exception {
>>              Attachment attachment = Attachment.loadFromTable(file, area);
>>              File tmpDir =
>> ConfigGlobal.i.resuelveRuta(LectorConfig.i.get().getChild("dirs").getChild("tmp").getValue());
>>              // creating a resource locator that is capable of retrieving 
>> libraries 
>>              // or images from the database...
>>              DataBaseResourceLocator dataBaseResourceLocator = new
>> DataBaseResourceLocator(area);
>>              IReportRunnable design =
>> getEngine().openReportDesign("test",attachment.getAsInputStream(),
>> dataBaseResourceLocator);
>>      
>> updateDataSources((ReportDesignHandle)design.getDesignHandle().getModuleHandle(),
>> petA);
>>              IRunAndRenderTask renderTask =
>> getEngine().createRunAndRenderTask(design);
>>              RenderOption opcRend;
>>              if ("pdf".equals(fmt)) {
>>                      PDFRenderOption opc = new PDFRenderOption();
>>                      opc.setOutputFormat("pdf");
>>                      //ReportDesignHandle designHandle =
>> (ReportDesignHandle)design.getDesignHandle().getModuleHandle();              
>>         
>>                      //designHandle.setDisplayName(null);
>>                      // para reducir la pagina tal como sale desde el 
>> diseƱador BIRT
>>                      opc.setOption(PDFRenderOption.PAGEBREAK_PAGINATION_ONLY,
>> autoPageBreaking);
>>                      opc.setOption(PDFRenderOption.FIT_TO_PAGE, 
>> autoPageBreaking);
>>                      
>>                      opcRend = opc;
>>              } else if ("excel".equals(fmt)){
>>                      // TODO: find if there is 
>>                      opcRend = new RenderOption();
>>                      opcRend.setOutputFormat("xls");                 
>>              } else {
>>                      HTMLRenderOption opc = new HTMLRenderOption();
>>                      opc.setHtmlTitle(design.getReportName());
>>                      opc.setBaseImageURL("/recursos/img/x.birt-img?imagen=");
>>                      opc.setImageDirectory(tmpDir.getAbsolutePath());
>>                      opc.setImageHandler(new HTMLServerImageHandler());
>>                      opcRend = opc;
>>              }
>>              // hanlde report paramteters.
>>              if(parametros_Reporte != null) {
>>                      Iterator<String> it = 
>> (Iterator<String>)parametros_Reporte.keys(); 
>>                      while(it.hasNext()) {
>>                              String param = it.next();
>>                              try {
>>                                      // first try to handle the parameter as 
>> multivalued.
>>                                      JSONArray array = 
>> parametros_Reporte.getJSONArray(param);
>>                                      Object[] values = new 
>> Object[]{array.length()};
>>                                      for(int i=0; i < array.length(); i++) {
>>                                              try {
>>                                                      values[i] = 
>> array.get(i);
>>                                              } catch (Exception e) {
>>                                                      values[i] = null;
>>                                              }
>>                                      }
>>                                      renderTask.setParameterValue(param, 
>> values);
>>                              } catch (Exception e) {
>>                                      // if parameter is not multi-valued 
>> then treat it as single-valued.
>>                                      String value = 
>> parametros_Reporte.getString(param);                             
>>                                      renderTask.setParameterValue(param, 
>> value);
>>                              }                               
>>                      }
>>              }
>>              opcRend.setOutputStream(out);                           
>>              renderTask.setLocale(locale);
>>              renderTask.setRenderOption(opcRend);
>>              renderTask.run();
>>      }
>>         .........
>>
>> }
>>
>> This class initializes a singleton BIRT runtime and the
>> generateBirtReport(...) method can be used to read the report design from
>> a database and generate the corresponding report (PDF, excel, HTML).  If
>> you filter out the logic that is specific to my use case you can easily
>> build your own machinery for building reports based on code given above.
>>
>> As for the generation of the download link there should be plenty of
>> examples and/or related threads in this list... 
>>
>> Best,
>>
>> Ernesto
>>
>>
>>
>>
>>
>>
>>
>> newbieabc wrote:
>>     
>>> The generation of the excel report.
>>> I am really new to BIRT and wicket..
>>> I've created the BIRT report (report.rptdesign)(in eclipse) but need it
>>> to be output as xls.
>>> I'd really appreciate some help. 
>>> Thank you
>>>
>>>
>>> reiern70 wrote:
>>>       
>>>> Sure you can... Which part is giving you problems? The generation of the
>>>> excel report with BIRT? Or the creation of the link?
>>>>
>>>> Best,
>>>>
>>>> Ernesto
>>>>
>>>> newbieabc wrote:
>>>>         
>>>>> Hello..
>>>>> How can create a download link on a webpage, that converts a BIRT
>>>>> report to
>>>>> excel format and downloads to client machine?
>>>>>
>>>>> Thank you.
>>>>>   
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>
>>>>
>>>>
>>>>         
>>>       
>>     
>
>   

Reply via email to