zoukankan      html  css  js  c++  java
  • ruby语言读取PPT中文本框和表格内容

    ppt = WIN32OLE::new('powerpoint.Application')
    ppt.DisplayAlerts = 1     #不显示任何警告
    ppt_presents = ppt.Presentations #演示文稿

    present = ppt_presents.open(filename,false,false,true)
    for slide in present.Slides
      for shape in slide.shapes
        if (shape.TextFrame.HasText == -1)
          begin     
            text = shape.TextFrame.TextRange.Text                                       ##按文本框读取PPT内容
          rescue

               ##抛出异常情况,比如文本框叠加等
          end
        elsif (shape.Type == 19)                                                           ##按表格读取PPT内容
          row = shape.Table.Rows.count
          column = shape.Table.columns.count
          for m in 1..row
            for n in 1..column
              text_table = shape.Table.Cell(m,n).Shape.TextFrame.TextRange.text
            end
          end
        end
      end
    end
    present.Save
    present.Close
    ppt.quit

  • 相关阅读:
    EL表达式具体解释
    Android 实战美女拼图游戏 你能坚持到第几关
    redis sentinel安装及配置(单机版)
    ElasticSearch scroll查询 api
    springboot自动配置原理
    kafka实践
    Springboot mybatis
    计算机原理
    快速排序算法
    maven常见报错问题
  • 原文地址:https://www.cnblogs.com/guilin-hu/p/3300350.html
Copyright © 2011-2022 走看看