zoukankan      html  css  js  c++  java
  • java对于07excel的读、改、写、并触发计算

         InputStream is = null;
            try {
                is = new FileInputStream(filePath);
            } catch (FileNotFoundException e1) {
                System.out.println("file not found");
            }
            XSSFWorkbook xwb =null;
            try {
                xwb= new XSSFWorkbook(is);//新建workbook时需要文件流的方式读入
            } catch (IOException e) {
                e.printStackTrace();
                return false;
            }
            xwb.setForceFormulaRecalculation(true);//设置更新内容后自动触发计算
    XSSFSheet sheet
    =xwb.getSheetAt(0); sheet.getRow(2).getCell(col).setCellValue(1);//对于excel的写操作,此处仅用一行代码表示 try { FileOutputStream fos = new FileOutputStream(filePath);//用文件流的方式将修改后的workbook输出到原文件中 xwb.write(fos); System.out.println("写入成功"); fos.close(); } catch (IOException e) { e.printStackTrace(); }
  • 相关阅读:
    brew基本使用
    手写函数
    http状态码——401和403差异
    HTTP状态码
    本地库和远程库交互
    IDEA集成Git
    Git命令
    数据库递归查询组织树父节点
    ZooKeeper程序员指南
    zookeeper简介
  • 原文地址:https://www.cnblogs.com/xiufengd/p/8251319.html
Copyright © 2011-2022 走看看