java jxl 读取excel
来源:互联网 发布:矢量软件 编辑:程序博客网 时间:2024/05/18 01:13
private void parseData(byte[] data) { InputStream is = new ByteArrayInputStream(data); Workbook book = null; try { book = Workbook.getWorkbook(is); Sheet sheet = book.getSheet(0); ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); for (int i = 0; i < sheet.getRows(); i++) { Cell[] cells = sheet.getRow(i); if (i == 0) { String[] cellArr = new String[cells.length]; for (int j = 0; j < cells.length; j++) { if (cells[j].getType() != CellType.EMPTY) { cellArr[j] = cells[j].getContents().replaceAll("\\n", ""); } } this.columns = cellArr; } else { HashMap<String, String> map = new HashMap<String, String>(); for(int j = 0; j < columns.length; j++) { String str = ""; if (!StringUtil.isNullOrEmpty(columns[j])) { if (cells[j].getType() == CellType.DATE) { DateCell datecell = (DateCell)cells[j]; Date date = datecell.getDate(); str = DateUtil.getDate(date); } else { str = cells[j].getContents(); } map.put(sheet.getRow(0)[j].getContents(), str); } } list.add(map); } } this.rows = list; } catch (BiffException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { book.close(); }}
阅读全文
0 0
- java jxl读取excel
- java jxl 读取excel
- jxl读取excel(java)
- java jxl 读取excel文件
- java 读取excel,jxl.jar下载地址:
- java 读取excel,jxl.jar下载地址:
- java读取excel文件(使用jxl)
- (java功能篇) jxl读取excel文本
- java中用jxl方式读取Excel
- Java:使用jxl读取excel文件内容
- JAVA利用jxl读取Excel内容
- JAVA利用jxl读取Excel内容
- JAVA利用jxl读取Excel内容
- java jxl之Excel的读取
- [JAVA] java读取Excel文件内容,jxl(Excel 2003)
- jxl 读取Excel图片
- jxl读取excel文件
- 用jxl读取excel
- 2017ACM-ICPC南宁网络赛Frequent Subsets Problem(康托展开+bfs)
- Java ———KMP算法(字符串匹配)
- Java 将枚举存入List集合
- Day4 基于DrawerLayout的菜单栏设计
- Springboot学习笔记(一)FastJson解析JSON数据
- java jxl 读取excel
- 排序算法学习体会
- 磁盘阵列RAID0,1,10,5,6
- Coursera/py4inf/python data structure 笔记 密歇根大学
- Java文件压缩
- GMapping源码分析之随手笔记
- Java9新特性——module模块系统
- 将多个txt文件导入到ORACLE
- java随机从数组中取出指定数目的值