Demo operations

更新时间:
复制 MD 格式

Perform operations on demo documents, such as exporting to PDF, retrieving page numbers, jumping to pages, and controlling slide animations.

Important

This document is no longer maintained. Use the new version of Intelligent Media Management.

Export to PDF

 /*
  * Currently, only the RangeType and FrameSlides parameters are supported.
  * @param: { RangeType?: MsoTriState, FrameSlides?: MsoTriState }
  * MsoTriState: {
  *      msoFalse: 0,
  *      msoTrue: -1
  *  }
  */
  await demo.PPTApplication().ActivePresentation.ExportAsFixedFormat()

Get page numbers and jump to pages

  • Retrieve the total number of pages

     /*
      * @return: number
      */
      let totalPages = await demo.PPTApplication().ActivePresentation.Slides.Count
  • Retrieve the current page

     /*
      * @return: number
      */
      let totalPages = await demo.PPTApplication().ActivePresentation.SlideShowWindow.View.Slide.SlideIndex
  • Jump to a specific page

     /*
      * @param: number
      */
      // Jump to page 3.
      await demo.PPTApplication().ActivePresentation.SlideShowWindow.View.GotoSlide(3)
  • Page change event

      function eventHandle() {
        // do something
      }
      // Add a listener for the page change event.
      demo.PPTApplication().Sub.SlideSelectionChanged = eventHandle
      // Destroy the event listener.
      demo.PPTApplication().Sub.SlideSelectionChanged = null

Slide animation control

Slide playback status and animation control are supported in V1.1.2 and later.

  • Switch to slide playback mode

    await demo.PPTApplication().ActivePresentation.SlideShowSettings.Run()
  • Exit slide playback and switch to preview mode

    await demo.PPTApplication().ActivePresentation.SlideShowWindow.View.Exit()
  • Next slide animation

    await demo.PPTApplication().ActivePresentation.SlideShowWindow.View.GotoNextClick()
  • Previous slide animation

    await demo.PPTApplication().ActivePresentation.SlideShowWindow.View.GotoPreClick()
  • Retrieve the current slide playback status

    /*
     * @return: string ('edit' | 'preview' | 'play')
     */
     let currentState = await demo.PPTApplication().ActivePresentation.SlideShowWindow.View.State
  • Retrieve the total number of animation steps for the current slide

    /*
     * @return: number
     */
     let clickCount = await demo.PPTApplication().ActivePresentation.SlideShowWindow.View.GetClickCount()
  • Retrieve the current animation step for the current slide

    /*
     * @return: number
     */
     let clickCount = await demo.PPTApplication().ActivePresentation.SlideShowWindow.View.GetClickIndex()
  • Callback event for switching to slide playback mode

    function eventHandle() {
       // do something
     }
     // Add a listener for the event.
     demo.PPTApplication().Sub.SlideShowBegin = eventHandle
     // Destroy the event listener.
     demo.PPTApplication().Sub.SlideShowBegin = null
  • Callback event for exiting slide playback and switching to preview mode

    function eventHandle() {
       // do something
     }
     // Add a listener for the event.
     demo.PPTApplication().Sub.SlideShowEnd = eventHandle
     // Destroy the event listener.
     demo.PPTApplication().Sub.SlideShowEnd = null
  • Callback event for the next slide animation

    function eventHandle() {
       // do something
     }
     // Add a listener for the event.
     demo.PPTApplication().Sub.SlideShowOnNext = eventHandle
     // Destroy the event listener.
     demo.PPTApplication().Sub.SlideShowOnNext = null
  • Callback event for the previous slide animation

    function eventHandle() {
       // do something
     }
     // Add a listener for the event.
     demo.PPTApplication().Sub.SlideShowOnPrevious = eventHandle
     // Destroy the event listener.
     demo.PPTApplication().Sub.SlideShowOnPrevious = null