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

  • 相关阅读:
    基本排序算法分析
    Linux内核浅谈
    Linux内核浅谈
    Linux内核浅谈
    淘宝架构技术的演变
    淘宝架构技术的演变
    淘宝架构技术的演变
    中间件小结
    中间件小结
    中间件小结
  • 原文地址:https://www.cnblogs.com/guilin-hu/p/3300350.html
Copyright © 2011-2022 走看看