文档

本文介绍Panes的方法、属性和事件。

Panes对象

任务窗口对象。

  • 语法

    表达式.Panes

    表达式:文档类型应用对象

  • 示例

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //任务窗口对象
      const panes = await app.Panes;
    }

方法

Panes.Add()

新增任务窗口。

  • 语法

    表达式.Add({ Caption, Visible })

    表达式:实例化的Panes对象

  • 参数

    属性

    数据类型

    是否必填

    描述

    Caption

    String

    任务窗口标题。

    Visible

    Boolean

    是否展示任务窗口。

  • 返回值

    返回对应的Panes对象。

  • 示例

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //任务窗口对象
      const panes = await app.Panes;
    
      //新增任务窗口
      const pane = await panes.Add({
        Caption: '任务窗口',
        Visible: true,
      });
    }

Panes.Delete()

删除任务窗口。

  • 语法

    表达式.Delete()

    表达式:实例化的Panes对象

  • 示例

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //任务窗口对象
      const panes = await app.Panes;
    
      //新增任务窗口
      const pane = await panes.Add({
        Caption: '任务窗口',
        Visible: true,
      });
    
      //3000 ms后删除任务窗口
      setTimeout(async () => {
        await pane.Delete();
      }, 3000);
    }

属性

Panes.Visible

隐藏或显示任务窗口。

  • 语法

    表达式.Visible

    表达式:实例化的Panes对象

  • 示例

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //任务窗口对象
      const panes = await app.Panes;
    
      //隐藏任务窗口
      const pane = await panes.Add({
        Caption: '任务窗口',
        Visible: false,
      });
    
      //3000 ms后显示任务窗口
      setTimeout(() => {
        pane.Visible = true;
      }, 3000);
    }

事件

Panes.OnClose

监听任务窗口关闭。

  • 语法

    表达式.OnClose = Function

    表达式:实例化的Panes对象

  • 示例

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //任务窗口对象
      const panes = await app.Panes;
    
      //新增任务窗口
      const pane = await panes.Add({
        Caption: '任务窗口',
        Visible: true,
      });
    
      //监听任务窗口关闭
      pane.OnClose = () => {
        console.log('任务窗口关闭');
      }
    }

Panes.OnShow

监听任务窗口显示。

  • 语法

    表达式.OnShow = Function

    表达式:实例化的Panes对象

  • 示例

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //任务窗口对象
      const panes = await app.Panes;
    
      //新增任务窗口
      const pane = await panes.Add({
        Caption: '任务窗口',
        Visible: true,
      });
    
      //监听任务窗口显示
      pane.OnShow = (e) => {
        console.log('任务窗口显示');
      }
    }
  • 本页导读 (1)
文档反馈