zoukankan      html  css  js  c++  java
  • POI中操作PPT获得每页的TABLE

    HSLFSlideShow slideShow = new HSLFSlideShow(bufferInputUtil.getBufferedInputStream());
            logger.info("正在脱敏:每页幻灯片的文本和表格内容");
            for (HSLFSlide slide : slideShow.getSlides()) {
                for (HSLFShape hslfShape : slide.getShapes()) {
                    if (hslfShape instanceof HSLFTable) {
                        hslfTable = (HSLFTable) hslfShape;
                        rowSize = hslfTable.getNumberOfRows();
                        columnSize = hslfTable.getNumberOfColumns();
                        for (int i = 0; i < rowSize; i++) {
                            for (int j = 0; j < columnSize; j++) {
                                cellValue = hslfTable.getCell(i, j).getText();
                                if (StringUtils.isNotBlank(cellValue) && StringUtils.isNotEmpty(cellValue)) {
                                    hslfTable.getCell(i, j).setText(this.getReplace(cellValue));
                                }
                            }
                        }
                    } else if (hslfShape instanceof HSLFTextShape) {
                        textShape = (HSLFTextShape) hslfShape;
                        cellValue = textShape.getText();
                        if (StringUtils.isNotBlank(cellValue) && StringUtils.isNotEmpty(cellValue)) {
                            textShape.setText(this.getReplace(cellValue));
                        }
                    }
                }
            }
     
    请见红色代码!
     
  • 相关阅读:
    commons-dbutils实现增删改查(spring新注解)
    commons-dbutils实现增删改查
    配置扫描注解的包
    常用注解
    注入集合类型数据
    spring创建bean的三种方式
    switch
    jvm编译器的优化
    java9小工具jshell
    java三元运算符
  • 原文地址:https://www.cnblogs.com/huiy/p/6000873.html
Copyright © 2011-2022 走看看