本站首页    管理页面    写新日志    退出


«September 2025»
123456
78910111213
14151617181920
21222324252627
282930


公告

我的分类(专题)

日志更新

最新评论

留言板

链接


Blog信息
blog名称:KENWOOD
日志总数:8
评论数量:13
留言数量:0
访问次数:59406
建立时间:2006年7月31日




如何在BIRT中定义SCRIPT数据集并用JAVA调用它
软件技术

Triger 发表于 2006/8/3 17:07:38

第一步:定义一下JAVA,class 第二步:定义一个LIST 第三步:在BIRT报表的DATASET事件中(open)中输入 count = 0; cf = new Packages.user.ContactListFactory(); c = cf.createContactList(); 第五步:在BIRT报表的DATASET事件中(CLOSE)中输入 cf=null; c=null; 第五步:在BIRT报表的DATASET事件中(FETCH)中输入 if (count <= c.length-1){ row["columnFirstName"] = c[count].getFname(); row["columnLastName"] = c[count].getLname(); row["columnPhoneNumber"]= c[count].getPhone(); count ++; return true; } return false; ------------------------------------------------第一二步的两个JAV类 代码发下: A:package user; public class Contact { String fname; String lname; String phone; public Contact(String fname, String lname, String phone){ this.fname = fname; this.lname = lname; this.phone = phone; } /** * @return Returns the fname. */ public String getFname() { return fname; } /** * @param fname The fname to set. */ public void setFname(String fname) { this.fname = fname; } /** * @return Returns the lname. */ public String getLname() { return lname; } /** * @param lname The lname to set. */ public void setLname(String lname) { this.lname = lname; } /** * @return Returns the phone. */ public String getPhone() { return phone; } /** * @param phone The phone to set. */ public void setPhone(String phone) { this.phone = phone; } } B:package user; public class ContactListFactory { public Contact[] createContactList(){ Contact[] c = new Contact[5]; c[0] = new Contact("stavros", "kounis", "2310886269"); c[1] = new Contact("dimitris", "kounis", "2310888270"); c[2] = new Contact("dimitris", "adamos", "2310998417"); c[3] = new Contact("nikos", "koufotolis", "2321013770"); c[4] = new Contact("yan", "liang", "13824745919"); return c; } } 注:发布后将两个JAVA类产生的CLASS 放在 C:\eclipse\plugins\org.eclipse.birt.report.viewer_2.1.0.N20060628-1351\birt\WEB-INF\classes\user 目录下,USER是开发时的包 经过发上步骤,再写一个JAVA PROJECT 调用上述报表 代码如下 package user; import javax.swing.JOptionPane; import user.ExecuteReport; public class Reporttest { public static void main(String args[]) { try { ExecuteReport mreport = new ExecuteReport(); mreport.executeReport(); } catch ( Exception e ) { e.printStackTrace(); } /*System.out.println("中国人民解"); JOptionPane.showMessageDialog(null,"中国人民解"); System.exit(0);*/ } } 主代码JAVA: package user; import java.util.Collection; import java.util.HashMap; import java.util.logging.Level; import javax.swing.text.html.HTMLDocument.Iterator; import org.eclipse.birt.core.framework.Platform; 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.HTMLActionHandler; import org.eclipse.birt.report.engine.api.HTMLEmitterConfig; import org.eclipse.birt.report.engine.api.HTMLRenderContext; import org.eclipse.birt.report.engine.api.HTMLRenderOption; import org.eclipse.birt.report.engine.api.HTMLServerImageHandler; import org.eclipse.birt.report.engine.api.IGetParameterDefinitionTask; import org.eclipse.birt.report.engine.api.IParameterDefnBase; import org.eclipse.birt.report.engine.api.IParameterGroupDefn; import org.eclipse.birt.report.engine.api.IParameterSelectionChoice; 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.IScalarParameterDefn; public class ExecuteReport { static void executeReport() throws EngineException{ IReportEngine engine=null; EngineConfig config = null; try{ //Configure the Engine and start the Platform config = new EngineConfig( ); config.setEngineHome( "C:/eclipse/workspace/ReportDrive/birt-runtime-2_1_0/ReportEngine" ); config.setLogConfig(null, Level.FINE); Platform.startup( config ); IReportEngineFactory factory = (IReportEngineFactory) Platform .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY ); engine = factory.createReportEngine( config ); engine.changeLogLevel( Level.WARNING ); }catch( Exception ex){ ex.printStackTrace(); } IReportRunnable design = null; //Open the report design design = engine.openReportDesign("C:/eclipse/workspace/html/kenScripDataset.rptdesign"); IRunAndRenderTask task = engine.createRunAndRenderTask(design); //Set rendering options - such as file or stream output, //output format, whether it is embeddable, etc HTMLRenderOption options = new HTMLRenderOption(); /////////////////////////////////////梁 HashMap parameters = new HashMap(); String name = "myreportname"; String pvalue ="客户产品工序表"; parameters.put(name,pvalue); task.setParameterValues(parameters); task.validateParameters(); //////////////////////////////////////梁 options.setOutputFileName("C:/eclipse/workspace/html/kenScripDataset.pdf"); //Set output format options.setOutputFormat("pdf"); task.setRenderOption(options); //run the report and destroy the engine //Note - If the program stays resident do not shutdown the Platform or the Engine task.run(); task.close(); engine.shutdown(); Platform.shutdown(); System.out.println("Finished"); System.exit(0); } } ---------------------------------------- 在eclispe 3.2的PATH BUILD中加入 BIRT 的com.ibm.icu_3.4.4.1 .JAR BIRT 的engineapi.JAR BIRT 的coreapi.JAR BIRT 的JS.JAR


阅读全文(7084) | 回复(1) | 编辑 | 精华
 


5 Super Cool Ways To Monetise Your Own Blog
软件技术

buy mbt lami shoes(游客)发表评论于2010/4/1 20:58:00

You've probably heard the news ....Whether you're an amateur blogger or a hardened and experienced professional, you are bound to have heard the stories about million dollar bloggers, massive media exposure and the huge marketing opportunities associated with online blogging. With so many bloggers earning lucrative five, six, or even seven-figure incomes, blogging has changed from a publishing form, which was once thought of as an online journal, to a serious force in the online entrepreneurship world. Regardless of what topic your blog deals with and who your readers are, it's easily possible to monetise your blog and create an online income for yourself. While these methods may take up some time to pick up steam, they'll invariably spawn a manageable online income for you once they gain enough traction and influence.#1 - Use Google AdSense to build PPC blog earnings.Google AdSense was once the knight in shining armour of blog advertising, and though it's glory days are feared to be over, it's still one of the most easy and lucrative online advertising networks around. Requiring minimal maintenance, Google AdSense is the perfect pick for any blogger that wants the minimum possible maintenance for their online income.#2 - Add Amazon affiliate links in your blog copy.Regardless of what you're blogging about, Amazon will sell something that's related to it. It's the world's biggest online store, it's impossible to have trouble locating something that your readers will be intere...


个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除
 


回复:如何在BIRT中定义SCRIPT数据集并用JAVA调用它
软件技术

dr(游客)发表评论于2007/1/26 19:16:17

非常感谢

个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除
 


» 1 »

发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.063 second(s), page refreshed 144778070 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号