Compare commits

...

2 Commits

Author SHA1 Message Date
黄海 faeee1b78e 'commit'
3 years ago
黄海 a5183be02d Default Changelist
3 years ago

@ -10,6 +10,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="lib" level="project" />
<orderEntry type="library" name="aspose-cells-8.5.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
<orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
<orderEntry type="library" name="Maven: net.sf.json-lib:json-lib:jdk15:2.4" level="project" />
@ -45,6 +46,5 @@
<orderEntry type="library" name="Maven: javax.mail:mail:1.4.7" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="library" name="Maven: net.sourceforge.jexcelapi:jxl:2.6.12" level="project" />
<orderEntry type="library" name="aspose-cells-8.5.2" level="project" />
</component>
</module>

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<Config>
<License>
<product>3</product>
<productName>"润乾报表"</productName>
<serialNo>3</serialNo>
<type>4</type>
<expiration>2</expiration>
<expirationDate>"2022-12-31"</expirationDate>
<serviceStartDate/>
<serviceExpiration>2</serviceExpiration>
<serviceExpirationDate/>
<stamp>"仅限学习试用,禁止商用"</stamp>
<fps>62</fps>
<functions>"oooo-oooo-ooxx-xxxo"</functions>
<cpu>1</cpu>
<IPRange>""</IPRange>
<host>""</host>
<vendor>"北京润乾信息系统技术有限公司"</vendor>
<vendorURL>"http://www.raqsoft.com.cn"</vendorURL>
<vendorTel>"010-51295366"</vendorTel>
<vendorLogo>""</vendorLogo>
<copyright>"2021-2022"</copyright>
<ISV>"润乾软件"</ISV>
<user>""</user>
<projectName>""</projectName>
<signature>"V2+VB9wpl/PibMxAm9p8weAQCI5+aQwH0V//f+cMeqdknWnDmHy+LgWpQwUueAnlw83xBVcTlbpQxE33E8YUCGRBNYcsygf89qd0v2oL0g1yfb5ms+phiSq285rdeUjt1vmEiClG9mrYnThqGA7FheEE+3AP6S7Ase1hKxzb2xI="</signature>
</License>
</Config>

@ -61,6 +61,4 @@ public class HtmlToExcel {
fos.close();
workbook.dispose();
}
}

@ -0,0 +1,83 @@
import com.raqsoft.dm.Sequence;
import com.raqsoft.report.usermodel.IReport;
import com.raqsoft.report.util.JsonUtil;
import com.raqsoft.report.util.ReportUtils;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.FileInputStream;
import static com.sun.org.apache.xml.internal.serialize.OutputFormat.Defaults.Encoding;
public class RplaceChuangChunRpx {
/*
* Java
*
* Created on: 2011-8-2
* Author:
*/
public static String getFileNameNoEx(String filename) {
if ((filename != null) && (filename.length() > 0)) {
int dot = filename.lastIndexOf('.');
if ((dot > -1) && (dot < (filename.length()))) {
return filename.substring(0, dot);
}
}
return filename;
}
//读取测试报表
static String sourcePath = "C:\\Users\\Administrator\\Desktop\\Report2019";
static String targetPath = "C:\\Users\\Administrator\\Desktop\\Report2019XT";
/**
* jsonrpx
*/
public static void Convert(File f1, File f2) throws Exception {
FileInputStream fis = new FileInputStream(f1);
System.out.println(f1.getName());
IReport report = ReportUtils.read(fis);
fis.close();
String json = JsonUtil.getJSONString(report);
json = json.replace("长春", "湘潭");
//另存为json文件
File fJson = new File("C:/json/" + getFileNameNoEx(f1.getName()) + ".json");
//System.out.println("json文件"+"C:/json/" + getFileNameNoEx(f1.getName()) + ".json");
//System.out.println(f2.getAbsolutePath());
//System.out.println(fJson.getAbsolutePath());
FileUtils.writeStringToFile(fJson, json, Encoding);
JsonUtil.transfer(fJson, f2);
System.out.println("文件" + f1.getName() + "转换成功!");
System.out.println();
}
public static void main(String[] args) throws Exception {
// 设置报表授权文件
File flic = new File("./reportTrialLicense20221231.xml");
FileInputStream lis = new FileInputStream(flic);
Sequence.readLicense(Sequence.P_RPT, lis);
//遍历所有文件进行处理
File file = new File(sourcePath);
File[] fs = file.listFiles();
for (File f : fs) {
if (!f.isDirectory()) {
Convert(f, new File(targetPath + "/" + getFileNameNoEx(f.getName()) + ".rpx"));
}
}
file = new File(sourcePath+"/县区");
File t=new File(targetPath + "/县区/");
if(!t.exists()) t.mkdir();
fs = file.listFiles();
for (File f : fs) {
if (!f.isDirectory()){
Convert(f, new File(targetPath + "/县区/" + getFileNameNoEx(f.getName()) + ".rpx"));
}
}
System.out.println("保存成功!");
}
}
Loading…
Cancel
Save