parent
571198c3ec
commit
d34055b2cf
@ -0,0 +1,41 @@
|
|||||||
|
import com.raqsoft.dm.Sequence;
|
||||||
|
import com.raqsoft.report.model.ReportDefine;
|
||||||
|
import com.raqsoft.report.usermodel.*;
|
||||||
|
import com.raqsoft.report.util.ReportUtils;
|
||||||
|
import com.raqsoft.report.util.StyleConfig;
|
||||||
|
import com.raqsoft.report.view.ReportExporter;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.Driver;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
|
||||||
|
public class DeleteBoldTitle {
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
FileInputStream fis = new FileInputStream("E:\\Work\\dsMin\\Report2020\\001各级各类教育校数、教职工数、专任教师情况.rpx");
|
||||||
|
ReportDefine rd = (ReportDefine) ReportUtils.read(fis);
|
||||||
|
int row = rd.getRowCount();//获取报表行数
|
||||||
|
int col = rd.getColCount();//获取报表列数
|
||||||
|
|
||||||
|
for (int i = 1; i <= row; i++)
|
||||||
|
for (int j = 1; j <= col; j++) {
|
||||||
|
INormalCell inc = rd.getCell(i, (short) j);
|
||||||
|
inc.setCellStyleName(null);
|
||||||
|
//System.out.println(inc.getCellStyleName());
|
||||||
|
}
|
||||||
|
System.out.println(row);
|
||||||
|
System.out.println(col);
|
||||||
|
OutputStream os = new FileOutputStream("d:\\1.rpx");
|
||||||
|
ReportUtils.write(os, rd);
|
||||||
|
System.out.println("恭喜,导出成功!");
|
||||||
|
}
|
||||||
|
}
|
@ -1,48 +0,0 @@
|
|||||||
import com.raqsoft.dm.Sequence;
|
|
||||||
import com.raqsoft.report.model.ReportDefine;
|
|
||||||
import com.raqsoft.report.usermodel.Context;
|
|
||||||
import com.raqsoft.report.usermodel.DataSourceConfig;
|
|
||||||
import com.raqsoft.report.usermodel.Engine;
|
|
||||||
import com.raqsoft.report.usermodel.IReport;
|
|
||||||
import com.raqsoft.report.util.ReportUtils;
|
|
||||||
import com.raqsoft.report.util.StyleConfig;
|
|
||||||
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\\RunQianUpdate\\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