本帖最后由 Richard.Huang 于 2023-11-24 16:04 编辑
产品:GcExcel
版本:6.1.4
问题编号:DOCXLS-9329
我在模板里面是设置了单元格格式的,但是绑定日期进去后并没有生效。
代码如下:
- public class DemoJsonDatasource3 {
- public static void main(String[] args) throws IOException {
- String index = "32";
- 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");
- }
- }
复制代码
|