本帖最后由 Lynn.Dou 于 2024-2-6 14:20 编辑
产品:GcExcel
版本:V6.2.1
我需要对绑定的数字字段求和,并希望结果能够自动合并单元格,但是结果不符合预期,应该怎么设置?
- public class DemoJsonDatasource3 {
- public static void main(String[] args) throws IOException {
- String index = "37";
- 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");
- }
- }
复制代码
|
|