本帖最后由 Joestar.Xu 于 2024-3-20 10:27 编辑
产品:GcExcel
版本:V6.1.4
问题编号:DOCXLS-8786
last review: 2024-3-20
该问题目前的计划是:在GcExcel V7.1版本中,会对整个模板功能进行重构。在整个重构之后接下来会对该问题进行修复。
模板绑定字段,然后字段里面可能存在null值,这个时候,模板渲染的结果是一个奇怪的数字。针对日期和字符串类型,甚至全列都是这个奇怪的数字,麻烦帮忙看看怎么回事。
- public class DemoJsonDatasource2 {
- public static void main(String[] args) throws IOException {
- Workbook workbook = new Workbook();
- String rootPath = "";
- String templateFile = rootPath+"24template.xlsx";
- workbook.open(templateFile);
- JsonDataSource datasource = new JsonDataSource("[" +
- "{"id":1,"intType":1,"floatType":1.1,"dateType":"2023-08-28","strType":"str1"}," +
- "{"id":2,"intType":null,"floatType":1.2,"dateType":"2023-08-28","strType":"str2"}," +
- "{"id":3,"intType":3,"floatType":null,"dateType":"2023-08-28","strType":"str3"}," +
- "{"id":4,"intType":4,"floatType":1.4,"dateType":null,"strType":"str4"}," +
- "{"id":5,"intType":5,"floatType":1.5,"dateType":"2023-08-28","strType":null}" +
- "]"
- );
- workbook.addDataSource("ds", datasource);
- workbook.processTemplate();
- workbook.save(rootPath+"24result.xlsx");
- }
- }
复制代码
|
|