因为EasyExcel基于POI的所以隐藏行用的是POI的方式,代码如下

 

@Test
    public void test1() throws Exception {
        String excelPath = "F:\\temp\\SiPrintViewNew111.xls";
        HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(excelPath));
        HSSFSheet sheet = workbook.getSheetAt(0);

        //Excel隐藏  80-120行
        for (Integer rowIndex = 80; rowIndex < 120; rowIndex++) {
            Row row = sheet.getRow(rowIndex);
            row.setZeroHeight(true);
        }

        //隐藏 第10列
        sheet.setColumnHidden(10,true);


        FileOutputStream out = null;
        try {
            out = new FileOutputStream(excelPath);
            workbook.write(out);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        System.out.println("OK");

    }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
  • 2021-05-25
  • 2022-12-23
  • 2021-08-29
猜你喜欢
  • 2021-06-15
  • 2021-06-27
  • 2021-06-12
  • 2021-05-03
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案