分享

VFP自动生成PowerPoint演示文稿

 王咸美 2013-08-10

 PptApp = CreateObject("Powerpoint.Application")
  * 添加一个 presentation
   PptPres = PptApp.Presentations.Add(1)

  * 添加一个幻灯片
    PptSlide1 = PptPres.Slides.Add(1,2)
 
  * 添加一些文本...
    PptSlide1.Shapes(1).TextFrame.TextRange.Text = "我的第一个幻灯片"
    PptSlide1.Shapes(2).TextFrame.TextRange.Text = "Automating Powerpoint is easy" + Chr(13) + "Using FoxPro is fun!"

 * 添加另一个带一个图表的幻灯片,
   PptSlide2 = PptPres.Slides.Add(2,5)

  * 添加一些文本
    PptSlide2.Shapes(1).TextFrame.TextRange.Text = "Slide 2's topic"
    PptSlide2.Shapes(1).TextFrame.TextRange.Text = "You can create and use charts in your Powerpoint slides!"
 
  * 添加一个图表当原来的...
    With PptSlide2.Shapes(3)
      cTop = .Top
      cWidth = .Width
       cHeight = .Height
       cLeft = .Left
      .Delete
   EndWith
 
    PptSlide2.Shapes.AddOLEObject(cLeft, cTop, cWidth, cHeight, "MSGraph.Chart")
 
  * 添加另一个幻灯片, 带一个组织图表
    PptSlide3 = PptPres.Slides.Add(3,7)
  * 添加一些文本
    PptSlide3.Shapes(1).TextFrame.TextRange.Text = "The rest is only limited by your Imagination"

  * 添加一个 Org 图表...
    With PptSlide3.Shapes(2)
       cTop = .Top
       cWidth = .Width
       cHeight = .Height
       cLeft = .Left
       .Delete
    EndWith
 
  PptSlide3.Shapes.AddOLEObject(cLeft, cTop, cWidth, cHeight, "OrgPlusWOPX.4")

  * 设置幻灯片的显示属性...
   With PptPres.Slides.Range.SlideShowTransition
      .EntryEffect = 513
       .AdvanceOnTime = 1
      .AdvanceTime = 5
    EndWith
 
  * 准备并运行 slide-show!
    With PptPres.SlideShowSettings
       .ShowType = 3
      .LoopUntilStopped = 1
      .RangeType = 1
       .AdvanceMode = 2
       .Run
   EndWith
 
 * 暂停让用户可以看到显示...
    Wait window "Waiting for slide show to finish..." TIMEOUT 16
 
  * 停止幻灯片显示
   PptPres.SlideShowWindow.View.Exit
  * 清除
    PptApp.Quit
    Release PptSlide3
    Release PptSlide2
    Release PptSlide1
    Release PptPres
    Release PptApp

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多