Panes

更新时间:
复制 MD 格式

This topic describes the methods, property, and events of the Panes object.

Panes

The Panes object.

  • Syntax

    expression.Panes

    expression: the document type application object.

  • Example

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // The Panes object.
      const panes = await app.Panes;
    }

Methods

Panes.Add()

Adds a pane.

  • Syntax

    expression.Add({ Caption, Visible })

    expression: the instantiated Panes object.

  • Parameters

    Property

    Type

    Required

    Description

    Caption

    String

    Yes

    The caption of the pane.

    Visible

    Boolean

    No

    Specifies whether to show the pane.

  • Return values

    Returns the corresponding Panes object.

  • Example

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // The Panes object.
      const panes = await app.Panes;
    
      // Add a pane.
      const pane = await panes.Add({
        Caption: 'Pane',
        Visible: true,
      });
    }

Panes.Delete()

Deletes a pane.

  • Syntax

    expression.Delete()

    expression: the instantiated Panes object.

  • Example

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // The Panes object.
      const panes = await app.Panes;
    
      // Add a pane.
      const pane = await panes.Add({
        Caption: 'Pane',
        Visible: true,
      });
    
      // Delete the pane after 3000 ms.
      setTimeout(async () => {
        await pane.Delete();
      }, 3000);
    }

Property

Panes.Visible

Hides or shows the pane.

  • Syntax

    expression.Visible

    expression: the instantiated Panes object.

  • Example

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // The Panes object.
      const panes = await app.Panes;
    
      // Hide the pane.
      const pane = await panes.Add({
        Caption: 'Pane',
        Visible: false,
      });
    
      // Show the pane after 3000 ms.
      setTimeout(() => {
        pane.Visible = true;
      }, 3000);
    }

Events

Panes.OnClose

Listens to the event that occurs when the pane is closed.

  • Syntax

    expression.OnClose = Function

    expression: the instantiated Panes object.

  • Example

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // The Panes object.
      const panes = await app.Panes;
    
      // Add a pane.
      const pane = await panes.Add({
        Caption: 'Pane',
        Visible: true,
      });
    
      // Listen to the event that occurs when the pane is closed.
      pane.OnClose = () => {
        console.log ('Pane closed');
      }
    }

Panes.OnShow

Listens to the event that occurs when the pane is shown.

  • Syntax

    expression. OnShow = Function

    expression: the instantiated Panes object.

  • Example

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // The Panes object.
      const panes = await app.Panes;
    
      // Add a pane.
      const pane = await panes.Add({
        Caption: 'Pane',
        Visible: true,
      });
    
      // Listen to the event that occurs when the pane is shown.
      pane.OnShow = (e) => {
        console.log ('Pane shown');
      }
    }