1金币
本帖最后由 Clark.Pan 于 2024-7-8 14:11 编辑
产品:GcExcel
版本:V6.2.1
调研编号:DOCXLS-9715
lastReview:2024-2-22
V7.0.3已修复。
代码如下:
- public class DemoJsonDatasource3 {
- public static void main(String[] args) throws IOException {
- String index = "35";
- 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");
- }
- }
复制代码
结果本来是整数,却加上了小数点
|
|