dongyue7796 2012-02-20 09:59
浏览 38
已采纳

Zend Server CE和BIRT与Javabridge集成[关闭]

I was able to get the Zend Server Java Bridge running and tested it successfully, but I am unable to find any information on how to get the Birt Engine to work with the Zend Server Java Bridge. Has anyone figured out how to get this to work?

i am facing the same issue can locate where to download the birt api to run birt reports

viewtopic.php?f=44&t=9452&p=30950&hilit=birt#p30950

If anybody have an example... please... show me how to do it... Thank you.

  • 写回答

3条回答 默认 最新

  • douchungu0859 2012-02-27 11:46
    关注

    If you download the 3.7 runtime you should be able to build a command line app that runs the reports. Attached is a simple example. To build the class make sure you have the jars from the runtime download/reportengine/lib directory in the classpath. Once built you should be able to call it the same way as the simple Java app. This sample does a platform startup and shutdown which is generally not a good idea if you are going to generate a lot of reports. A better solution is to wrap the Platform startup and report engine creation in a singleton that starts when you server starts up, then use the engine to create a new task per request.

    import java.util.logging.Level;
    
    import org.eclipse.birt.core.framework.Platform;
    import org.eclipse.birt.report.engine.api.EXCELRenderOption;
    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.HTMLRenderOption;
    import org.eclipse.birt.report.engine.api.HTMLServerImageHandler;
    import org.eclipse.birt.report.engine.api.IReportEngine;
    import org.eclipse.birt.report.engine.api.IReportEngineFactory;
    import org.eclipse.birt.report.engine.api.IReportRunnable;
    import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
    import org.eclipse.birt.report.engine.api.PDFRenderOption;
    import org.eclipse.birt.report.engine.api.RenderOption;
    import org.eclipse.birt.report.engine.api.impl.RunAndRenderTask;
    import org.eclipse.birt.report.engine.api.script.IReportContext;
    
    
    public class RunAndRenderTaskTest {
    
    public void runReport() throws EngineException
    {
    
    RunAndRenderTask task=null;
    IReportEngine engine=null;
    EngineConfig config = null;
    
    try{
    config = new EngineConfig( );   
    //config.setLogConfig("c:/dwn", Level.SEVERE);
    //config.setResourcePath("C:/work/workspaces/3.7.1workspaces/BIRT 
    Metal/APIs/resources");
    Platform.startup( config );
    
    IReportEngineFactory factory = (IReportEngineFactory) Platform
    .createFactoryObject( 
    IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
    engine = factory.createReportEngine( config );
    
    
    IReportRunnable design = null;
    //Open the report design
    
    design = engine.openReportDesign("Reports/testlibrary.rptdesign");
    task = (RunAndRenderTask) engine.createRunAndRenderTask(design);    
    IReportContext irc = task.getReportContext();
    //task.setParameterValue("Top Count", (new Integer(5)));
    //task.validateParameters();
    
    
    //HTMLRenderOption options = new HTMLRenderOption();    
    //options.setImageDirectory("./");
    //options.setOutputFileName("output/resample/external.html");
    //options.setOutputFormat("html");
    //options.setEmbeddable(false);
    //options.setEnableMetadata(true);
    //options.setEnableInlineStyle(false);
    //options.setEnableAgentStyleEngine(true);
    //options.setEnableCompactMode(true);
    
    //PDFRenderOption options = new PDFRenderOption();
    //options.setOutputFileName("output/resample/hidefooter.pdf");
    //options.setSupportedImageFormats("PNG;GIF;JPG;BMP;SWF;SVG");
    //options.setOutputFormat("pdf");
    
    //EXCELRenderOption options = new EXCELRenderOption();  
    //options.setOutputFormat("xls");
    //options.setOutputFileName("output/resample/customers.xls");
    //options.setWrappingText(true);
    
    HTMLRenderOption options = new HTMLRenderOption();
    //options.setImageHandler(new HTMLServerImageHandler());
    options.setSupportedImageFormats("JPG;PNG;BMP;SVG;GIF");
    options.setOutputFileName("output/resample/testlibrary.html");
    options.setOutputFormat("html");
    //options.setOutputFormat("ppt");
    
    
    
    task.setRenderOption(options);
    task.run();
    
    irc = task.getReportContext();
    
    task.close();
    engine.destroy();
    }catch( Exception ex){
    ex.printStackTrace();
    }   
    Platform.shutdown( );
    System.out.println("Finished");
    
    
    
    }   
    
    
    /**
    * @param args
    */
    public static void main(String[] args) {
    try
    {
    
    RunAndRenderTaskTest ex = new RunAndRenderTaskTest( );
    ex.runReport();
    
    System.exit(0);
    
    }
    catch ( Exception e )
    {
    e.printStackTrace();
    }
    }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
  • douchibu7040 2012-02-20 13:20
    关注

    i have found some info on integrating birt on zend platform u can also refer this pdf file

    http://static.zend.com/topics/Zend-Platform-User-Guide-v360-new.pdf

    评论
  • donglikuang8145 2012-02-20 13:36
    关注

    The Zend_Birt is not part of Zend Framework but only of Zend Platform. It is not part of Zend Server CE afaik. However, the BIRT API is a Java API. So by using Zend Server's JavaBridge API you can interface with the BIRT API from PHP. The Zend_Birt API you are looking for is just a thin wrapper for that. You can try to grab a copy from

    There is also a detailed blogpost explaining how to use BIRT reporting without Zend Platform via a JavaBride. It apparently hooks directly into the BIRT runtime environment.

    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 用C语言绘制cs1.6方框透视 出现了点问题 绘制不上去 矩阵数据 和敌人坐标都是正确的
  • ¥15 Tpad api账户 api口令
  • ¥30 ppt进度条制作,vba语言
  • ¥15 生信simpleaffy包下载
  • ¥15 请教一下simulink中S函数相关问题
  • ¥15 在二层网络中,掩码存在包含关系即可通信
  • ¥15 端口转发器解析失败不知道电脑设置了啥
  • ¥15 Latex算法流程图行号自定义
  • ¥15 关于#python#的问题:我在自己的电脑上运行起来总是报错,希望能给我一个详细的教程,(开发工具-github)
  • ¥40 基于51单片机实现球赛计分器功能