附上自定义的代码:
package jatools.util;
public class SetMsg {
/**
* 分割表
*/
public static void setFGB(){
jatools.dom.src.RootNodeSource rsa = (jatools.dom.src.RootNodeSource)jatools.ReportDocument.nodeSource;
jatools.dom.src.DatasetNodeSource dns = (jatools.dom.src.DatasetNodeSource) rsa.getChildren().get(0);
jatools.dom.src.DatasetNodeSource dns1 = (jatools.dom.src.DatasetNodeSource) rsa.getChildren().get(1);
jatools.data.reader.sql.SqlReader sr = new jatools.data.reader.sql.SqlReader();
String driver = "org.hsqldb.jdbcDriver";
String url = "jdbc:hsqldb:C:/demosdb/mydb";
String user = "sa";
String password = "";
sr.setSql("select top 5 * from 订单查询");
sr.setConnection(new jatools.data.reader.sql.Connection(driver, url, user, password));
sr.setName("订单查询");
dns.setReader((jatools.data.reader.DatasetReader)sr);
dns.setTagName("result_0");
jatools.data.reader.sql.SqlReader sr2 = new jatools.data.reader.sql.SqlReader();
sr2.setSql("select top 5 * from 供应商");
sr2.setConnection(new jatools.data.reader.sql.Connection(driver, url, user, password));
sr2.setName("供应商");
dns1.setReader((jatools.data.reader.DatasetReader)sr2);
dns1.setTagName("result_1");
}
/**
* 分栏报表
*/
public static void setFL(){
jatools.dom.src.RootNodeSource rsa = (jatools.dom.src.RootNodeSource)jatools.ReportDocument.nodeSource;
jatools.dom.src.DatasetNodeSource dns = (jatools.dom.src.DatasetNodeSource) rsa.getChildren().get(0);
jatools.data.reader.sql.SqlReader sr = new jatools.data.reader.sql.SqlReader();
String driver = "org.hsqldb.jdbcDriver";
String url = "jdbc:hsqldb:C:/demosdb/mydb";
String user = "sa";
String password = "";
sr.setSql("SELECT 订单明细.订单ID,订单明细.单价,订单明细.数量,订单明细.折扣,产品.产品名称 FROM 订单明细,产品 where 订单明细.产品ID =产品.产品ID");
sr.setConnection(new jatools.data.reader.sql.Connection(driver, url, user, password));
sr.setName("订单明细");
dns.setReader((jatools.data.reader.DatasetReader)sr);
dns.setTagName("订单明细");
}
}