try (InputStream is = getClass().getResourceAsStream("template.xlsx")) { try (OutputStream os = new FileOutputStream("output.xlsx")) { Context context = new Context(); } } try (InputStream is = new FileInputStream("template.xlsx")) { try (OutputStream os = new FileOutputStream("output.xlsx")) { try (InputStream configInputStream = getClass().getResourceAsStream("config.xml")) { XLSReader xlsReader = ReaderBuilder.buildFromXML(configInputStream); try (InputStream dataInputStream = new FileInputStream("data.xlsx")) { Workbook dataWorkbook = WorkbookFactory.create(dataInputStream); Workbook outputWorkbook = WorkbookFactory.create(is); Map<String, Object> beans = new HashMap<>(); Context context = new Context(beans); xlsReader.read(dataWorkbook, outputWorkbook, context); } } } }


上一篇:
下一篇:
切换中文