dongyue7796
dongyue7796
2012-02-20 09:59

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 douchungu0859 9年前

    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();
    }
    }
    }
    
    点赞 评论 复制链接分享
  • donglikuang8145 donglikuang8145 9年前

    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.

    点赞 评论 复制链接分享
  • douchibu7040 douchibu7040 9年前

    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

    点赞 评论 复制链接分享

为你推荐