Home > SYS_FileManager > setDocumentSource
SYS_FileManager.setDocumentSource() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Modify Document source code
Signature
typescript
function setDocumentSource(source: string): Promise<boolean>;1
Parameters
Parameter | Type | Description |
|---|---|---|
source | string | Document source code |
Returns
Promise<boolean>
Whether the modification was successful. If the input document source code format is incorrect, false is returned
Example
javascript
// 1. 读取当前文档源码
const source = await eda.sys_FileManager.getDocumentSource();
// 2. 把源码原样写回文档(源码格式合法,返回 true 表示修改成功)
const modified = await eda.sys_FileManager.setDocumentSource(source);
// 3. 输出修改结果
console.log('修改结果:', modified);1
2
3
4
5
6
7
8
2
3
4
5
6
7
8