JXLS模板转换无法正常工作

时间:2019-03-02 06:49:36

标签: java excel jxls

我已经在excel中创建了一个模板,可以通过jxls进行转换,但是它不起作用。 我已经附上了这个问题的模板。

Java代码:

公共静态void main(String [] args)抛出FileNotFoundException,IOException {

    File initialFile = new File("input_test.xlsx");
    try (InputStream is = new FileInputStream(initialFile)) {
    try (OutputStream os = new FileOutputStream("output_test.xlsx")) {
            Context context = new Context();
            context.putVar("myTest", "Test Name");
            JxlsHelper.getInstance().processTemplate(is, os, context);
        }
    }

}

在input_test.xlsx文件中,我仅在单元格A2中写入$ {myTest}。

0 个答案:

没有答案
相关问题