Mount Document
The mount node refers to the HTML DOM node where the document application is mounted when inserted into the page. When the SDK is initialized, it will automatically insert an iframe element under the mount node and render the document application in this iframe element.
Syntax
ZOfficeSDK.mount(url, selector, bAsync, config)
Return Value
Application: Document type application object
- Excel: Excel.Workbook
- Word: Word.Document
- PDF: PDF.Pdf
Parameters
| Property | Data Type | Required | Description |
|---|---|---|---|
| url | string | Yes | Address of the document to be mounted |
| selector | string | Yes | Selector of the DOM node to mount the document |
| bAsync | boolean | No | true means return Application before the document is loaded, but you need to call the Application.ready() method to wait for the document to load before using advanced APIs (recommended to pass true, return available Application earlier before document content is loaded, avoiding long waiting time) |
| config | JSON | No | Can customize initialization to show/hide page components |
Note
Filez Document Platform supports Frontend SDK integration mode from v8.1 onwards, and the url is of type object. See Frontend SDK Integration Mode for details.
Example
Taking mounting a spreadsheet document with address http://172.16.22.98/docs/app/thirdparty-rest/1347466381985058817/edit/content?zdocs_access_token=653b90d845a785e3c69aeba as an example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>JSSDK</title>
</head>
<body>
<div id="doc1" class="doc-container"></div>
<script src="sdk address"></script>
<script>
window.onload = async function() {
const Application = await ZOfficeSDK.mount('http://172.16.22.98/docs/app/thirdparty-rest/1347466381985058817/edit/content?zdocs_access_token=653b90d845a785e3c69aeba', '#doc1', true);
await Application.ready();
const sheets = await Application.ActiveWorkbook.getSheets()
console.log(sheets);
}
</script>
</body>
</html>