Commit 413bfe9a by yuwei

2.0.0项目初始化

parent a19cf9d9
......@@ -33,8 +33,23 @@ public class WordUtil {
* 去除水印
*/
static {
String license =
"<License>\n" +
" <Data>\n" +
" <Products>\n" +
" <Product>Aspose.Cells for Java</Product>\n" +
" <Product>Aspose.Words for Java</Product>\n" +
" <Product>Aspose.Slides for Java</Product>\n" +
" </Products>\n" +
" <EditionType>Enterprise</EditionType>\n" +
" <SubscriptionExpiry>20991231</SubscriptionExpiry>\n" +
" <LicenseExpiry>20991231</LicenseExpiry>\n" +
" <SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>\n" +
" </Data>\n" +
" <Signature>datax</Signature>\n" +
"</License>";
try {
new License().setLicense(new ByteArrayInputStream("license".getBytes("UTF-8")));
new License().setLicense(new ByteArrayInputStream(license.getBytes("UTF-8")));
} catch (Exception e) {}
}
......@@ -133,29 +148,29 @@ public class WordUtil {
}
public static void main(String[] args) throws Exception {
Map<String, Object> map = new HashMap<>();
map.put("companyName", "测试");
map.put("totalSalary", new BigDecimal("12.34"));
List<Map<String, Object>> list = new ArrayList<>();
Map<String, Object> map1 = new HashMap<>();
map1.put("name", "测试1");
map1.put("age", 12);
map1.put("sex", "男");
map1.put("salary", new BigDecimal("5.0"));
list.add(map1);
Map<String, Object> map2 = new HashMap<>();
map2.put("name", "测试2");
map2.put("age", 14);
map2.put("sex", "女");
map2.put("salary", new BigDecimal("7.34"));
list.add(map2);
List<String> objects1 = new ArrayList<>();
List<Object> objects2 = new ArrayList<>();
for(Map.Entry<String, Object> entry : map.entrySet()){
objects1.add(entry.getKey());
objects2.add(entry.getValue());
}
WordUtil.getInstance().fillWordListData(objects1.toArray(new String[objects1.size()]), objects2.toArray(new Object[objects2.size()]), "F:\\test\\模板.docx", "F:\\test\\123.docx", list, "workerList");
// WordUtil.getInstance().word2pdf("F:\\test\\审批流提交.docx", "F:\\test\\20200420.pdf");
// Map<String, Object> map = new HashMap<>();
// map.put("companyName", "测试");
// map.put("totalSalary", new BigDecimal("12.34"));
// List<Map<String, Object>> list = new ArrayList<>();
// Map<String, Object> map1 = new HashMap<>();
// map1.put("name", "测试1");
// map1.put("age", 12);
// map1.put("sex", "男");
// map1.put("salary", new BigDecimal("5.0"));
// list.add(map1);
// Map<String, Object> map2 = new HashMap<>();
// map2.put("name", "测试2");
// map2.put("age", 14);
// map2.put("sex", "女");
// map2.put("salary", new BigDecimal("7.34"));
// list.add(map2);
// List<String> objects1 = new ArrayList<>();
// List<Object> objects2 = new ArrayList<>();
// for(Map.Entry<String, Object> entry : map.entrySet()){
// objects1.add(entry.getKey());
// objects2.add(entry.getValue());
// }
// WordUtil.getInstance().fillWordListData(objects1.toArray(new String[objects1.size()]), objects2.toArray(new Object[objects2.size()]), "F:\\test\\模板.docx", "F:\\test\\123.docx", list, "workerList");
WordUtil.getInstance().word2pdf("F:\\test\\审批流提交.docx", "F:\\test\\20200420.pdf");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment