parent
3aba8fc052
commit
230f9aac60
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.checkerframework:checker-qual:3.5.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.postgresql:postgresql:42.2.20">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/42.2.20/postgresql-42.2.20.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/42.2.20/postgresql-42.2.20-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/42.2.20/postgresql-42.2.20-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -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("恭喜,导出成功!");
|
||||
}
|
||||
}
|
Binary file not shown.
Loading…
Reference in new issue