产品:GcExcel
版本:V6.2.1
处理模板报错:java.util.ConcurrentModificationException
- public class DemoJsonDatasource3 {
- public static void main(String[] args) throws IOException {
- String index = "36";
- Workbook workbook = new Workbook();
- String rootPath = "";
- String templateFile = rootPath + index + ".template.xlsx";
- workbook.open(templateFile);
- String dataFile0 = rootPath + index + ".ds0.json.txt";
- JsonDataSource datasource0 = new JsonDataSource(new String(Files.readAllBytes(Paths.get(dataFile0)), StandardCharsets.UTF_8));
- workbook.addDataSource("ds0", datasource0);
- boolean page = false;
- if (page) {
- workbook.getNames().add("TemplateOptions.PaginationMode", "true");
- for (IWorksheet worksheet : workbook.getWorksheets()) {
- worksheet.getPageSetup().setPaperSize(PaperSize.A2);
- worksheet.getPageSetup().setOrientation(PageOrientation.Landscape);
- }
- }
- workbook.processTemplate();
- workbook.save(rootPath + index + ".result.xlsx");
- }
- }
复制代码
|
|