社区
Java
帖子详情
The method getBytes() is undefined for the type Long
未始之末
2014-10-28 08:55:07
这种错误怎么解决,求大神指导
...全文
362
5
打赏
收藏
The method getBytes() is undefined for the type Long
这种错误怎么解决,求大神指导
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
未始之末
2014-10-28
打赏
举报
回复
try { FileOutputStream fout = new FileOutputStream("E:/capt.xls"); wb.write(fout); fout.close(); } catch (Exception e) { e.printStackTrace(); } LOG.debug("exportExcel - end!"); return "E:/ca.xls"; } } }
shixitong
2014-10-28
打赏
举报
回复
hrts = new HSSFRichTextString(new String(entry.getCerEndtime().getBytes(), "gbk")); hrts = new HSSFRichTextString(new String(entry.getId().getBytes(), "gbk")); 看下这个entry.getCerEndtime()和entry.getId()的返回值是什么
未始之末
2014-10-28
打赏
举报
回复
int currentpage = 1; int cnt = 0; int totalpage = 0; int pagecnt = 1000; // 设置总页数 if (cnt % pagecnt == 0) { totalpage = cnt / pagecnt; } else { totalpage = cnt / pagecnt + 1; } // 设置报表的Sheet数 int sheetcnt = 1000; // 每个Sheet中记录的数目 int totalSheet; if (cnt % sheetcnt == 0) { totalSheet = cnt / sheetcnt; } else { totalSheet = cnt / sheetcnt + 1; } String[] ret = null; String path = ""; CaptPfxCert captPfxCert = CaptPfxCert.getCaptPfxCertInfo(); String basePath = captPfxCert.getCode(); if ((basePath == null) || ("".equals(basePath))) { basePath = "E:capt.xls"; } String inputPath = basePath; String outputPath = basePath; captPfxCert = CaptPfxCert.getCaptPfxCertInfo(); int baseLine = Integer.parseInt(captPfxCert.getCode()); FileInputStream filein = null; try { filein = new FileInputStream(inputPath + "/" + "capt.xls"); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } POIFSFileSystem fs = null; try { fs = new POIFSFileSystem(filein); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } HSSFWorkbook wb = null; try { wb = new HSSFWorkbook(fs); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } for (int i = 2; i <= totalSheet; i++) { wb.cloneSheet(0); } for (int i = 0; i < totalSheet; i++) { String sheetName = "证书查询" + "(" + totalSheet + "-" + (i + 1) + ")"; wb.setSheetName(i, sheetName); wb.getSheetAt(i).setSelected(false); } HSSFSheet sheet; HSSFCellStyle style; HSSFCellStyle styleLeft; int rowPos = 0; int pos; HSSFRow row; HSSFCell cell; HSSFRichTextString hrts; sheet = wb.getSheetAt(0); style = wb.createCellStyle(); style.setBorderTop(HSSFCellStyle.BORDER_THIN); style.setBorderLeft(HSSFCellStyle.BORDER_THIN); style.setBorderRight(HSSFCellStyle.BORDER_THIN); style.setTopBorderColor(HSSFColor.BLACK.index); style.setBorderBottom(HSSFCellStyle.BORDER_THIN); style.setAlignment(HSSFCellStyle.ALIGN_CENTER); styleLeft = wb.createCellStyle(); styleLeft.setBorderTop(HSSFCellStyle.BORDER_THIN); styleLeft.setBorderLeft(HSSFCellStyle.BORDER_THIN); styleLeft.setBorderRight(HSSFCellStyle.BORDER_THIN); styleLeft.setTopBorderColor(HSSFColor.BLACK.index); styleLeft.setBorderBottom(HSSFCellStyle.BORDER_THIN); styleLeft.setAlignment(HSSFCellStyle.ALIGN_LEFT); rowPos = 0; hrts = new HSSFRichTextString(); // 输出报表文件 int sheetIndex = 0; int recordcnt = 0; for (currentpage = 1; currentpage <= totalpage; currentpage++) { List list=new ArrayList(); for (int i = 0; i < list.size(); i++, rowPos++) { // 判断是否使用下一个Sheet if (recordcnt % sheetcnt == 0) { sheet = wb.getSheetAt(sheetIndex); style = wb.createCellStyle(); style.setBorderTop(HSSFCellStyle.BORDER_THIN); style.setBorderLeft(HSSFCellStyle.BORDER_THIN); style.setBorderRight(HSSFCellStyle.BORDER_THIN); style.setTopBorderColor(HSSFColor.BLACK.index); style.setBorderBottom(HSSFCellStyle.BORDER_THIN); style.setAlignment(HSSFCellStyle.ALIGN_CENTER); styleLeft = wb.createCellStyle(); styleLeft.setBorderTop(HSSFCellStyle.BORDER_THIN); styleLeft.setBorderLeft(HSSFCellStyle.BORDER_THIN); styleLeft.setBorderRight(HSSFCellStyle.BORDER_THIN); styleLeft.setTopBorderColor(HSSFColor.BLACK.index); styleLeft.setBorderBottom(HSSFCellStyle.BORDER_THIN); styleLeft.setAlignment(HSSFCellStyle.ALIGN_LEFT); rowPos = 0; hrts = new HSSFRichTextString(); sheetIndex++; } recordcnt++; CaptPfxCert entry = (CaptPfxCert) list.get(i); row = sheet.createRow((short) baseLine + rowPos); pos = 0; // NO cell = row.createCell((short) pos++); hrts = new HSSFRichTextString(new String(String.valueOf(recordcnt).getBytes(), "gbk")); cell.setCellStyle(style); // 主键 cell = row.createCell((short) pos++); if (entry.getId() == null) { hrts = new HSSFRichTextString(new String("".getBytes(), "gbk")); } else { hrts = new HSSFRichTextString(new String(entry.getId() .getBytes(), "gbk")); } cell.setCellStyle(styleLeft);
未始之末
2014-10-28
打赏
举报
回复
cell = row.createCell((short) pos++); if (entry.getCerEndtime() == null) { hrts = new HSSFRichTextString(new String("".getBytes(), "gbk")); } else { hrts = new HSSFRichTextString(new String(entry.getCerEndtime() .getBytes(), "gbk")); } cell.setCellStyle(styleLeft);
shixitong
2014-10-28
打赏
举报
回复
贴代码,从标题看,只能说使用不当的方法,Long 类型的没有这个方法getBytes()
常见的java问题1
1.抽象: 抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关的方面。抽象并不打算了解全部问题,而只是选择其中的一部分,暂时不用部分细节。抽象包括两个方面,一是过程抽象,二是数据抽象。 2.继承: 继承是一种联结类的层次模型,并且允许和鼓励类的重用,它提供了一种明确表述共性的方法。对象的一个新类可以从现有的类中派生,这个过程称为类继承。新类继承了原始类...
求助java编程错误
求助java编程错误在这里插入图片描述 就是它老是显示54行有问题 那到底是哪有问题呢?????
SonarLint检测出的bug、漏洞修复总结
1、Introduce a new variable instead of reusing the parameter "prefixKey" 不要用传递过来的参数去重新赋值做判断等 可以新建一个参数 等于传递过来的参数 用新的参数去操作 private String getBatchSaveKey(Map<String, String> map, String prefixKey, String... keys) {
undefined
//创建一个newPrefix...
String
Modulejava.base Packagejava.lang Class String java.lang.Object java.lang.String All Implemented Interfaces: Serializable,CharSequence,Comparable<String> public final class String extends Object implements Serializable, Comparable&l...
2018.3.21 JDK源码分析之String源码分析
写在前面的话 首先,最近有人在问我String、StringBuffer、StringBuilder的部分问题,我觉得还是深入探讨一下为好,所以开了这个坑,带领大家来初略的领略一下JDK源码是如何对这个三个类进行设计的(基于JDK1.8); 所谓的字符串就是一系列字符的集合,所以我们可以把字符串当作数组来看待。 观察定义结构 String类的定义结构(JDK1.0) public fin...
Java
50,541
社区成员
85,619
社区内容
发帖
与我相关
我的任务
Java
Java相关技术讨论
复制链接
扫一扫
分享
社区描述
Java相关技术讨论
java
spring boot
spring cloud
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章