找回密码
 立即注册

QQ登录

只需一步,快速开始

葡萄种子
金牌服务用户   /  发表于:2023-8-16 12:38  /   查看:1877  /  回复:8
本帖最后由 Joestar.Xu 于 2023-8-16 16:55 编辑

数据和模板如附件。

代码如下:

  1. public class DemoCsvDatasource {
  2.     public static void main(String[] args) throws FileNotFoundException {
  3.         long start = System.currentTimeMillis();
  4.         String index = "23";
  5.         Workbook workbook = new Workbook();
  6.         String rootPath = "";
  7.         String templateFile = rootPath+index+"template.xlsx";
  8.         workbook.open(templateFile);
  9.         workbook.getNames().add("TemplateOptions.PaginationMode", "true");
  10.         System.out.println("open template cost: "+(System.currentTimeMillis() - start)/1000.0);
  11.         java.sql.ResultSet datasource = new GcMockResultSet(getFileStream(rootPath+index+"data.csv"));
  12.         System.out.println("open data source cost: "+(System.currentTimeMillis() - start)/1000.0);
  13.         workbook.addDataSource("ds", datasource);
  14.         System.out.println("add data source cost: "+(System.currentTimeMillis() - start)/1000.0);
  15.         workbook.processTemplate();
  16.         System.out.println("process template cost: "+(System.currentTimeMillis() - start)/1000.0);
  17.         workbook.save(rootPath+index+"result.xlsx");
  18.         System.out.println("save xlsx cost: "+(System.currentTimeMillis() - start)/1000.0);
  19.         for (IWorksheet worksheet : workbook.getWorksheets()) {
  20.             worksheet.getPageSetup().setIsPercentScale(false);
  21.             worksheet.getPageSetup().setFitToPagesWide(1);
  22.         }
  23.         workbook.save(rootPath+index+"result.pdf");
  24.         System.out.println("save pdf cost: "+(System.currentTimeMillis() - start)/1000.0);
  25.         System.out.println("final cost: "+(System.currentTimeMillis() - start)/1000.0);
  26.     }

  27.     private static InputStream getFileStream(String filePath) throws FileNotFoundException {
  28.         return new FileInputStream(filePath);
  29.     }
  30. }
复制代码


image.png750173644.png

请问我哪里设置有问题吗

gc-excel-test23.zip

228.96 KB, 下载次数: 223

8 个回复

倒序浏览
Joestar.XuSpreadJS 开发认证
超级版主   /  发表于:2023-8-16 16:55:21
沙发
您好,问题已重现,这边调研一下,后续有进展我会在本贴中回复您。

本帖先做保留处理了。
回复 使用道具 举报
Joestar.XuSpreadJS 开发认证
超级版主   /  发表于:2023-9-15 11:27:41
板凳
您好,该问题已在新版本中修复,您可以升级后测试一下。
回复 使用道具 举报
葡萄种子
金牌服务用户   /  发表于:2023-9-15 11:43:16
地板
Joestar.Xu 发表于 2023-9-15 11:27
您好,该问题已在新版本中修复,您可以升级后测试一下。

具体是哪个版本呢,6.2.1修复了没?
回复 使用道具 举报
Joestar.XuSpreadJS 开发认证
超级版主   /  发表于:2023-9-15 12:04:12
5#
您好,修复的版本为6.2.1。
回复 使用道具 举报
葡萄种子
金牌服务用户   /  发表于:2023-9-15 17:47:14
6#
Joestar.Xu 发表于 2023-9-15 12:04
您好,修复的版本为6.2.1。

您好,我用本问题的模板来测试6.2.1,还是有问题呢,你们能确认一下吗
回复 使用道具 举报
Joestar.XuSpreadJS 开发认证
超级版主   /  发表于:2023-9-18 09:54:18
7#
不好意思,您将GcMockResultSet.java替换为我附件中的文件再试试看。

问题的根源在于GcMockResultSet缺失了一个函数的实现。

GcMockResultSet.java

28.13 KB, 下载次数: 134

回复 使用道具 举报
葡萄种子
金牌服务用户   /  发表于:2023-9-18 16:37:27
8#
Joestar.Xu 发表于 2023-9-18 09:54
不好意思,您将GcMockResultSet.java替换为我附件中的文件再试试看。

问题的根源在于GcMockResultSet缺 ...

好的,可以了。
回复 使用道具 举报
Joestar.XuSpreadJS 开发认证
超级版主   /  发表于:2023-9-18 16:42:49
9#
好的,那就先结贴了,后续有其他问题的话随时开新帖提问哈。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部