<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 20, comments - 16, trackbacks - 0, articles - 0

    首先,本文講的方法適合的環(huán)境是:使用xml作為birt的數(shù)據(jù)源,但不同場(chǎng)合需要不同的xml文件,但制作.rptdesign文件時(shí)只運(yùn)行輸入一個(gè)xml文件,怎樣實(shí)現(xiàn)動(dòng)態(tài)數(shù)據(jù)源呢?以下將解決這個(gè)問(wèn)題。

    同時(shí),本文所講的方法,可以稍加改造,適合所有需要管理器向.rptdesign文件傳入?yún)?shù)的情況。例如,你不僅需要?jiǎng)討B(tài)數(shù)據(jù)源,還可以需要?jiǎng)討B(tài)的報(bào)表標(biāo)題、某處的文字、動(dòng)態(tài)的參數(shù)、等等。

    在這里,我只說(shuō)思路代碼,具體細(xì)節(jié),見(jiàn)我提供的實(shí)例工程。

    這里,我以插件工程為例。首先,建立一個(gè)工程,然后是建一個(gè).rptdesign,在其中的數(shù)據(jù)源,選xml,然后使用如下的xml文件的路徑:

    <ROOT>
        
    <FACTOR NAME="Maintainability">
          
    <PECENT NAME="Execllent" VALUE="0.00"/>
          
    <PECENT NAME="Good" VALUE="0.75"/>
          
    <PECENT NAME="Fair" VALUE="0.25"/>
          
    <PECENT NAME="Poor" VALUE="0.00"/>
        
    </FACTOR>
    </ROOT>

     

    注意在outline視圖中選中 Data Source ,然后在屬性窗口中選中 Event Handler ,在里面填入類(lèi)的地址:

    net.rual.learn.eventhandler.FunTableHandler

    然后在相應(yīng)位置建立這個(gè)FunTableHandler類(lèi),繼承至DataSourceEventAdapter類(lèi),覆蓋beforeOpen方法,如下:

     

    package net.raul.lern.eventhandler;

    import org.eclipse.birt.report.engine.api.script.IReportContext;
    import org.eclipse.birt.report.engine.api.script.eventadapter.DataSourceEventAdapter;
    import org.eclipse.birt.report.engine.api.script.instance.IDataSourceInstance;

    /**
     * 
    @author Vincent
     * 
     
    */

    public class FunTableHandler extends DataSourceEventAdapter {


        @Override
        
    public void beforeOpen(IDataSourceInstance dataSource,
                IReportContext reportContext) 
    {
            
    // TODO Auto-generated method stub

            String xmlFile 
    = (String) reportContext.getReportRunnable()
                    .getReportEngine().getConfig().getProperty(
    "user.datasource");
            
    // xmlFile =
            
    // "E:/c.xml";
            dataSource.setExtensionProperty("FILELIST", xmlFile);
            
    super.beforeOpen(dataSource, reportContext);
        }


    }


    然后編寫(xiě)管理器類(lèi):

        public String executeReport(String repPath, String xmlFilePath,
                String FileName, String FunName) 
    throws EngineException {
            String outPutFilePath 
    = proPath + "/report/" + FunName + "_"
                    
    + FileName.substring(0, FileName.length() - 4+ ".html";

            
    // Engine Configuration - set and get temp dir, BIRT home, Servlet
            
    // context
            EngineConfig config = new EngineConfig();
            
    // config.setEngineHome(
            
    // "E:/work/eclipses/eclipse4birt/birt-runtime-2_2_1_1/ReportEngine" );
            config.setEngineHome(getEnvirStr("BIRT_HOME"+ "/ReportEngine");
            
            config.setProperty(
    "user.projectclasspath",
                    
    "E:/work/workspaces/kaudit/kaudit.071224/com.zte.audit.ui/bin");
            config.setProperty(
    "user.datasource", xmlFilePath);
            
    // config.setProperty("user.funname", "main");
            
    // 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(repPath);
            
    // Create task to run the report - use the task to execute and run the
            
    // report,
            IRunAndRenderTask task = engine.createRunAndRenderTask(design);
            task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY,
                    FunTableHandler.
    class.getClassLoader());
            
    // IReportRunnable runnable = engine.openReportDesign( source );
            
    // 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);
            
    // contextMap
            
    // .put(EngineConstants.PROJECT_CLASSPATH_KEY,
            
    // "E:/work/workspaces/kaudit/kaudit.071224/com.zte.audit.ui/bin");
            task.setAppContext(contextMap);

            
    // Set rendering options - such as file or stream output,
            
    // output format, whether it is embeddable, etc
            HTMLRenderOption options = new HTMLRenderOption();
            
    // options.setOutputFileName("D:/customer.html");
            options.setOutputFileName(outPutFilePath);
            options.setOutputFormat(
    "html");
            task.setRenderOption(options);
            
    // run the report and destroy the engine
            task.run();
            
    // task.addScriptableJavaObject(arg0, arg1)
            engine.destroy();

            
    return outPutFilePath;
        }


        
    public static String getEnvirStr(String name) {
            
    // System.getenv("BIRT_HOME");
            return System.getenv(name);
        }



    因?yàn)闀r(shí)間很緊,我沒(méi)有辦法寫(xiě)得很詳細(xì),等過(guò)年放假的時(shí)候,我好好整理,再放上來(lái)。

    Feedback

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)[未登錄](méi)  回復(fù)  更多評(píng)論   

    2008-03-26 11:04 by cxh
    寫(xiě)的好,繼續(xù)呀

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)[未登錄](méi)  回復(fù)  更多評(píng)論   

    2008-05-12 18:16 by cxh
    老大,例子程序傳一份,讓俺也學(xué)習(xí)學(xué)習(xí)

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)  回復(fù)  更多評(píng)論   

    2008-05-19 12:32 by Raul Gong
    @cxh
    好的,你的郵箱是多少?你也可以加我的msn哈:
    vincent.gong@hotmail.com

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)  回復(fù)  更多評(píng)論   

    2008-07-04 13:48 by RogerTu
    BIRT開(kāi)發(fā)團(tuán)隊(duì)就在國(guó)內(nèi),關(guān)于BIRT的問(wèn)題,推薦BIRT官方中文論壇http://www.actuatechina.com/index.php,工程師們的響應(yīng)還是贊的

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)  回復(fù)  更多評(píng)論   

    2008-09-27 10:26 by new birt
    老大給我一份,行不嘛
    jinsui_sc@163.com
    謝謝!

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)  回復(fù)  更多評(píng)論   

    2008-10-21 14:09 by jm
    多謝!讀了后幫助很大。

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)  回復(fù)  更多評(píng)論   

    2009-02-04 14:04 by fzl
    能否給發(fā)一份完整的實(shí)例,謝謝!
    郵箱:fanzengl@eastsoft.com.cn

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)[未登錄](méi)  回復(fù)  更多評(píng)論   

    2009-04-10 00:49 by test
    http://www.javaworld.com/javaworld/jw-06-2008/jw-06-osgi3.html?page=5

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)[未登錄](méi)  回復(fù)  更多評(píng)論   

    2009-04-10 01:02 by test
    http://developer.51cto.com/java/

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)[未登錄](méi)  回復(fù)  更多評(píng)論   

    2009-05-09 00:45 by test
    flex
    http://www.jeromeloo.cn/?page_id=180
    http://livedocs.adobe.com/flex/3/html/help.html
    http://www.jeromeloo.cn/wp-demo/SpringGraph/SpringGraphDemo.htm
    http://www.diybl.com/course/1_web/webjs/200877/131260.html
    l

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)[未登錄](méi)  回復(fù)  更多評(píng)論   

    2009-05-09 00:52 by test
    http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=1048510#

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)[未登錄](méi)  回復(fù)  更多評(píng)論   

    2009-09-09 10:54 by test
    http://www.cnblogs.com/wyqtomorrow/archive/2007/05/19/752275.html

    # re: birt中動(dòng)態(tài)數(shù)據(jù)的實(shí)現(xiàn)  回復(fù)  更多評(píng)論   

    2012-07-26 09:22 by 小攤
    可以給我一份嗎?呵呵
    主站蜘蛛池模板: 亚洲免费在线视频| 亚洲国产欧洲综合997久久| 免费在线看v网址| 日韩色视频一区二区三区亚洲 | 十八禁的黄污污免费网站| 亚洲韩国精品无码一区二区三区| 久久ww精品w免费人成| 亚洲综合精品伊人久久| 自拍偷自拍亚洲精品第1页| 久久国产色AV免费看| 国产精品亚洲а∨天堂2021| 亚洲av无码乱码国产精品| 免费无遮挡无码视频网站| a级毛片在线免费| 亚洲成AV人片高潮喷水| 亚洲AV无码国产丝袜在线观看 | 国产午夜无码片免费| 久久综合久久综合亚洲| 亚洲无线观看国产精品| 女性无套免费网站在线看| 最近2019中文免费字幕在线观看| 亚洲欧美日韩综合久久久久| 五月天网站亚洲小说| 高清在线亚洲精品国产二区| 麻豆视频免费观看| 国产中文字幕在线免费观看| 亚洲乱码国产乱码精华| 久久亚洲春色中文字幕久久久| 亚洲乱码中文字幕综合234 | 亚洲性猛交xx乱| 亚洲欧洲自拍拍偷午夜色无码| 韩国日本好看电影免费看| 午夜免费1000部| 天黑黑影院在线观看视频高清免费| 亚洲人成无码网站在线观看| 久久av无码专区亚洲av桃花岛| 亚洲中文字幕无码一区| 国产乱弄免费视频| 四虎免费在线观看| 999久久久免费精品国产| 久久免费国产视频|