Public

更新时间:
复制 MD 格式

This topic describes the methods and properties of the Public object.

Public

A public processing function.

  • Syntax

    expression.Public

    expression: the document type application object.

  • Example

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

Methods

Public.SendBroadcast()

Sends a global broadcast.

  • Syntax

    expression.SendBroadcast({ Data, Id })

    expressions: the instantiated Public object

  • Parameters

    Property

    Type

    Required

    Description

    Data

    Object

    Yes

    The message of the broadcast.

    Id

    Boolean

    No

    The ID of the user who receives the message.

  • Return values

    Returns the corresponding Public object.

  • Example

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Public processing object.
      const Public = await app.Public;
    
      // Send a global broadcast.
      const result = await Public.SendBroadcast({
        Data: {message: 'Test'}
      });
    }

Public.PreviewRestore()

Restores a previous version of a document.

  • Syntax

    expression.PreviewRestore({ Version, Reversion, })

    expressions: the instantiated Public object

  • Parameters

    Property

    Type

    Required

    Description

    Version

    number

    Yes

    Restore based on a previous version.

    Revision

    number

    No

    Restore based on revision records.

    HistoryId

    string

    No

    The ID of the previous version.

  • Return values

    Returns the corresponding Public object.

  • Example

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Public processing object.
      const Public = await app.Public;
    
      // Restore a previous version of a document.
      const pane = await Public.PreviewRestore({
            Version:535,
            HistoryId:'test'});
    }

Public.DispatchModelVisible()

Dispatches an operation event of a third-party pop-up.

  • Syntax

    expression.DispatchModelVisible({ Visible })

    expressions: the instantiated Public object

  • Parameters

    Property

    Type

    Required

    Description

    Visible

    boolean

    No

    The visualization status. Default value: false.

  • Return values

    Returns the corresponding Public object.

  • Example

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Public processing object.
      const Public = await app.Public;
    
      // Dispatch an operation event of a third-party pop-up.
      const pane = await Public.DispatchModelVisible(true);
    }

Public.OpenLink()

Encapsulates window.open and adds it to the link security check logic. This operation uses the same parameters as window.open().

  • Syntax

    expression.OpenLink()

    expressions: the instantiated Public object

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
    
      await app.Public.OpenLink('https://www.aliyun.com')
    }

Property

Public.KeyBoardHeight

Obtains and specifies the height of keyboards on mobile devices.

Important

The height that you specify is in Logical Pixels. Before you specify the height, convert physical pixels into logical pixels.

  • Syntax

    expression.KeyBoardHeight

    expressions: the instantiated Public object

  • Example

    //@file=base.docx
    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Public processing object.
      const Public = await app.Public;
    
      // Obtain the height of keyboards on mobile devices.
      const height = await Public.KeyBoardHeight;
    
      // Specify a height.
      Public.KeyBoardHeight = 48;
    }