Home > SYS_FileManager > getDocumentFile
SYS_FileManager.getDocumentFile() method
Get Document file
Signature
typescript
function getDocumentFile(
fileName?: string,
password?: string,
fileType?: 'epro' | 'epro2',
): Promise<File | undefined>;1
2
3
4
5
2
3
4
5
Parameters
Parameter | Type | Description |
|---|---|---|
fileName | string | (Optional) File name |
password | string | (Optional) Encrypted password |
fileType | 'epro' | 'epro2' | (Optional) File format |
Returns
Promise<File | undefined>
Document file data, undefined indicates that it is currently not open document or data retrieval failed
Remarks
You can use SYS_FileSystem.saveFile() API export the file to the local file system
Note: This API requires the **Engineering Design > File Export** permission. Calling it without permission will always throw Error
Example
javascript
// 1. 导出当前文档为文件(文件名自动带上 epro2 扩展名)
const documentFile = await eda.sys_FileManager.getDocumentFile('嘉立创示例_文档导出');
// 2. 输出文件信息(size 单位为字节)
console.log('文件名:', documentFile.name);
console.log('文件大小:', documentFile.size);1
2
3
4
5
6
2
3
4
5
6