diff --git a/RunQianUpdate/.idea/libraries/Maven__org_checkerframework_checker_qual_3_5_0.xml b/RunQianUpdate/.idea/libraries/Maven__org_checkerframework_checker_qual_3_5_0.xml new file mode 100644 index 00000000..b41c4fe5 --- /dev/null +++ b/RunQianUpdate/.idea/libraries/Maven__org_checkerframework_checker_qual_3_5_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/RunQianUpdate/.idea/libraries/Maven__org_postgresql_postgresql_42_2_20.xml b/RunQianUpdate/.idea/libraries/Maven__org_postgresql_postgresql_42_2_20.xml new file mode 100644 index 00000000..1e7ede13 --- /dev/null +++ b/RunQianUpdate/.idea/libraries/Maven__org_postgresql_postgresql_42_2_20.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/RunQianUpdate/RunQianUpdate.iml b/RunQianUpdate/RunQianUpdate.iml index 0f70efdc..d26ca521 100644 --- a/RunQianUpdate/RunQianUpdate.iml +++ b/RunQianUpdate/RunQianUpdate.iml @@ -9,6 +9,7 @@ + @@ -40,6 +41,7 @@ - + + \ No newline at end of file diff --git a/RunQianUpdate/pom.xml b/RunQianUpdate/pom.xml index eff83120..9ba39191 100644 --- a/RunQianUpdate/pom.xml +++ b/RunQianUpdate/pom.xml @@ -113,6 +113,12 @@ ant 1.9.7 + + + org.postgresql + postgresql + 42.2.20 + diff --git a/RunQianUpdate/src/Test.java b/RunQianUpdate/src/Test.java new file mode 100644 index 00000000..91905758 --- /dev/null +++ b/RunQianUpdate/src/Test.java @@ -0,0 +1,46 @@ +import com.raqsoft.dm.Sequence; +import com.raqsoft.report.model.ReportDefine; +import com.raqsoft.report.usermodel.Context; +import com.raqsoft.report.usermodel.Engine; +import com.raqsoft.report.usermodel.IReport; +import com.raqsoft.report.util.ReportUtils; +import com.raqsoft.report.view.ReportExporter; + +import java.io.File; +import java.io.FileInputStream; +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; + +public class Test { + public static void main(String[] args) throws Throwable { + // 设置报表授权文件 + File flic = new File("./reportTrialLicense20211231.xml"); + FileInputStream lis = new FileInputStream(flic); + Sequence.readLicense(Sequence.P_RPT, lis); + + //加载报表 + String reportFile = "E:\\Work\\dsMin\\Report2020\\001各级各类教育校数、教职工数、专任教师情况.rpx"; //该文件名可以为绝对路径,也可以相对当前程序启动路径 + ReportDefine rd = (ReportDefine) ReportUtils.read(reportFile); + + //构建报表引擎计算环境 + Context cxt = new Context(); + Connection con = null; + try { + Driver driver = (Driver) Class.forName("org.postgresql.Driver").newInstance(); + DriverManager.registerDriver(driver); + con = DriverManager.getConnection("jdbc:postgresql://10.10.14.206:5432/eduData_db", "root", "DsideaL147258369"); + } catch (Exception e) { + e.printStackTrace(); + } + cxt.setConnection("HUANGHAI", con); //这样设定默认数据源 + cxt.setDefDataSourceName("HUANGHAI"); + + Engine engine = new Engine(rd, cxt); //构造报表引擎 + IReport iReport = engine.calc(); //运算报表 + ReportExporter re = new ReportExporter("c:\\1.xls", ReportExporter.EXPORT_EXCEL); //导出为Excel + re.export(iReport); //导出 + + System.out.println("恭喜,导出成功!"); + } +} diff --git a/RunQianUpdate/target/classes/Test.class b/RunQianUpdate/target/classes/Test.class new file mode 100644 index 00000000..6efde324 Binary files /dev/null and b/RunQianUpdate/target/classes/Test.class differ