当前位置: 首页 > news >正文

长安区网站建设上海aso

长安区网站建设,上海aso,wordpress中文读音,3d建模设计1 简单读取操作 public class ExcelRead {String PATH D:\\Idea-projects\\POI\\POI_projects;// 读取的一系列方法// ...... } 因为07版本和03版本操作流程大差不差#xff0c;所以这边就以03版本为例 Testpublic void testRead03() throws IOException {//获取…1 简单读取操作 public class ExcelRead {String PATH D:\\Idea-projects\\POI\\POI_projects;// 读取的一系列方法// ...... } 因为07版本和03版本操作流程大差不差所以这边就以03版本为例 Testpublic void testRead03() throws IOException {//获取文件流FileInputStream fileInputStream new FileInputStream(PATH xiexu03.xls);//1.创建一个工作簿获取到文件中的内容Workbook workbook new HSSFWorkbook(fileInputStream);// 2.得到表获取具体位置的内容Sheet sheet workbook.getSheetAt(0);// 3.得到行Row row sheet.getRow(0);// 4.得到列Cell cell row.getCell(1);// System.out.println(cell.getStringCellValue()); // 得到单元格中的字符串内容System.out.println(cell.getNumericCellValue()); // 得到单元格中的数字内容fileInputStream.close();} 2 分类型读取数据 读取下列含有不同数据类型的Excel表格并输出读取的数据 Testpublic void testCellType() throws IOException {//获取文件流FileInputStream fileInputStream new FileInputStream(D:\\Idea-projects\\POI\\明细表.xls);//1.创建一个工作簿Workbook workbook new HSSFWorkbook(fileInputStream);Sheet sheet workbook.getSheetAt(0);// 2. 获取标题内容Row rowTitle sheet.getRow(0);if (rowTitle ! null) {// 这种写法一定要掌握int cellCount rowTitle.getPhysicalNumberOfCells(); // 读取所有有数据的单元格数量for (int cellNum 0; cellNum cellCount; cellNum) {Cell cell rowTitle.getCell(cellNum);if (cell ! null) {CellType cellType cell.getCellType();String cellValue cell.getStringCellValue();System.out.print(cellValue | );}}System.out.println();}// 获取表中的内容int rowCount sheet.getPhysicalNumberOfRows(); // 获取所有含有数据的行的数量for (int rowNum 1; rowNum rowCount; rowNum) {Row rowData sheet.getRow(rowNum);if (rowData ! null) {// 读取行中的列int cellCount rowTitle.getPhysicalNumberOfCells();for (int cellNum 0; cellNum cellCount; cellNum) {System.out.print([ (rowNum 1) - (cellNum 1) ]);Cell cell rowData.getCell(cellNum);// 匹配列的数据类型if ( cell ! null) {CellType cellType cell.getCellType();String cellValue ;switch (cell.getCellType()) {case STRING:System.out.println(字符串);cellValue cell.getStringCellValue();break;case BLANK:System.out.println(空);break;case BOOLEAN:System.out.println(布尔);cellValue String.valueOf(cell.getBooleanCellValue());break;case NUMERIC:System.out.println(数字); // 分为日期和普通数字if (DateUtil.isCellDateFormatted(cell)) {System.out.println(日期);Date date cell.getDateCellValue();DateTime time new DateTime(date);cellValue time.toString(yyyy-MM-dd);} else{// 普通数字 - 转换为字符串输出System.out.println(转换为字符串输出);cell.setCellType(CellType.STRING); // 需要设置类型为字符串cellValue cell.toString();}break;case ERROR:System.out.println(数据类型错误);break;}System.out.println(cellValue);}}}}fileInputStream.close();} 3 读取公式 Testpublic void testReadCalculate() throws IOException { // 公式//获取文件流FileInputStream fileInputStream new FileInputStream(D:\\Idea-projects\\POI\\公式.xls);//1.创建一个工作簿Workbook workbook new HSSFWorkbook(fileInputStream);// 2.得到表Sheet sheet workbook.getSheetAt(0);// 3.得到行Row row sheet.getRow(4);// 4.得到列Cell cell row.getCell(0);// 拿到计算公式FormulaEvaluator formulaEvaluator new HSSFFormulaEvaluator((HSSFWorkbook) workbook);// 输出单元格的内容CellType cellType cell.getCellType();switch (cell.getCellType()) {case FORMULA:System.out.println(公式);String formula cell.getCellFormula(); // 获取计算公式System.out.println(formula);// 计算CellValue evaluate formulaEvaluator.evaluate(cell);String cellValue evaluate.formatAsString(); // 将计算结果格式化为字符串// 输出System.out.println(cellValue);break;}fileInputStream.close();}
http://www.hkea.cn/news/14549294/

相关文章:

  • 商城类网站总体功能策划网站可以用ai做吗
  • dtu网站开发西地那非可以长期吃吗
  • 做后期从哪个网站选音乐长沙3天2晚自由行攻略
  • 企业产品展示网站源码高端建站需要什么条件
  • 宠物网站建设网站推广现状
  • 福州医保网站调入申报怎么做淮南发布
  • 国家级建设网站泉州网上房地产
  • app展示网站模板html51688域名网站
  • 专业做网站服务学生管理系统网站
  • 表白墙网站怎么做做网站购买模板
  • 网站管理制度建设网站建设规范
  • 设计网站大全铲鼠湖南岚鸿相信求几个微信推广平台
  • 企业网站建设开发如何制作网站详细教程
  • 免费的ppt模板网站有哪些网站建设的相关职位
  • 上海网站建设口碑好集团公司网页设计
  • 手机网站建设分析谷哇网站建设
  • 城乡厅建设部网站首页泸州市建设工程管理局网站
  • 网站排名推广自己怎么做电商网站前端页面内容编写
  • 做网站公司不负责任怎么办阿里云商标注册入口
  • 张氏万家网站建设网站建设需要什么人才
  • 有模板怎么做网站网站备案幕布ps
  • 上海网站开发外包四川网站营销seo费用
  • 旅游网站设计模板深圳有多少互联网公司
  • 如何链接自己做的网站企业手机网站建设特色
  • 微信微商城怎么进入优化英语
  • 域名注册好了如何做网站汕头门户网站建设
  • dell网站设计特色电脑怎么建网站详细步骤
  • 网站开发与网页设计深圳极速网站建设公司
  • 设计公司做网站价格当前业界主流的网站建设
  • 接网站开发项目四川省建设厅信息平台