GCExcel V5.2之后,支持在数据绑定中使用JSON作为数据源,详细使用方法如下:- public static void testJsonBind() {
- String jsonStr = "{"name":"lilac","age":25}";
- Workbook wb = new Workbook();
- IWorksheet ws = wb.getWorksheets().get(0);
- ws.getRange("A2").setBindingPath("age");
- ws.setDataSource(new JsonDataSource(jsonStr));
- ws.getRange("A1").setBindingPath("name");
- wb.save("test.xlsx");
- }
复制代码 到处之后,文件显示如下:
|
|