var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-20738293-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script')"/>

          jutleo
          歡迎走進有風的地方~~
          posts - 63,  comments - 279,  trackbacks - 0
                  終于又開始閑下來寫寫blog了,大半年時間一直都在忙,加上自己比較懶惰一點,回頭來看看真是浪費了很多時間,下來該多督促自己記錄點什么。
                 jasperReport對國際化的支持是很到位的,但是國內基本不怎么使用,下來看看國際化的使用吧!
           

                新建一空白報表,還是和以前一致 添加reportTitle參數,添加一個圖片控件、幾個textField控件用來顯示國際化內容:
              
          選擇report propertys 對話框

          這個一看就明白了,資源文件名字為I18nReportDemo,只要classPath可以找到就可以了;資源文件大致內容如下:
          # Locale i18n_zh_CN for report I18nReportDemo.jrxml
          text.section1
          =\u8fd9\u662fIreport+JasperReport i18n\u7684\u4e00\u4e2ademo
          text.section2
          =\u56fd\u9645\u5316\u662f\u4e2a\u4ec0\u4e48\u73a9\u610f\u561b
          text.section3
          =Struts2-jasperReport-plugin.jar\u4e0d\u77e5\u9053\u662f\u4e0d\u662f\u8fd9\u6837\u7684bug\uff0c\u4f46\u662f\u6211\u4fee\u6539\u540e\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e86
          image.url
          =eg_smile.gif
          text.showInfor
          =\u56fd\u9645\u5316\u6211\u89c9\u5f97\u9700\u6c42\u4e0d\u5927\uff0c\u4e0d\u8fc7\u597d\u50cf\u7ed3\u5408scriptlet\u4f7f\u7528\u53ef\u4ee5\u4f7fJasperReport\u7684\u529f\u80fd\u66f4\u52a0\u5f3a\u5927
          text.contributors
          =Author-bulktree,\nLAOSHULIN,\nwww.aygfsteel.com/bulktree
          有一點很重要,iReport使用$R{key}符號引用資源文件對應的key,前面提到的圖片控件已用圖片也可以使用這種方式簡單的引用,資源文件可以使用\n換行。
                 還是那幾行通用的代碼:
          JasperReport jasperReport = JasperCompileManager.compileReport(path);
                  HashMap parameters 
          = new HashMap();
                  parameters.put(
          "ReportTitle""LAOSHULIN");
                  JasperPrint jasperPrint 
          = JasperFillManager.fillReport(jasperReport, parameters, new JREmptyDataSource());
                  JasperViewer jv 
          = new JasperViewer(jasperPrint);
                  jv.setVisible(
          true);



          iReport 給我們提供了很多的便利,只要發掘你會有意想不到的收獲。
          posted on 2009-10-18 15:44 凌晨風 閱讀(2686) 評論(3)  編輯  收藏 所屬分類: iReport + JasperReport 系列

          FeedBack:
          # re: iReport+jasperReport之i18n國際化支持
          2009-10-20 03:22 | 美容
          iReport+jasperReport之i18n國際化支持 good  回復  更多評論
            
          # re: iReport+jasperReport之i18n國際化支持[未登錄]
          2009-11-27 10:20 | jun
          文中又說 “只要classPath可以找到就可以了”
          請問classpath需要加入的是什么?  回復  更多評論
            
          # re: iReport+jasperReport之i18n國際化支持
          2009-11-28 08:07 | 凌晨風
          當然是國際化資源文件了  回復  更多評論
            

          <2009年11月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(11)

          我參與的團隊

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          新聞分類

          新聞檔案

          收藏夾

          圍脖

          最新隨筆

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 平罗县| 富裕县| 汶川县| 峨眉山市| 青冈县| 黔西县| 湟源县| 富锦市| 云和县| 桐庐县| 珲春市| 德惠市| 景谷| 临沧市| 荆州市| 海盐县| 绥芬河市| 民丰县| 濮阳市| 乌恰县| 祁门县| 璧山县| 涟水县| 日土县| 乐东| 同江市| 辉南县| 焦作市| 章丘市| 西充县| 高台县| 青海省| 西藏| 永昌县| 永寿县| 平果县| 会昌县| 丰镇市| 民乐县| 沁阳市| 城市|