CreateFile(创建文件)
创建一个新文件。需要设置将要创建的文件类型。
语法
def CreateFile(self, int | str type);
参数
| 参数 | 类型 | 描述 |
|---|---|---|
| type | int | str | 要创建的文件类型,在Python代码中设置为十六进制整数,在.docbuilder脚本文件中设置为docx、xlsx、pptx或pdf(参见OFFICESTUDIO_FILE_XXX值)。 |
示例
- Python
- .docbuilder
import os
import docbuilder
builder = docbuilder.CDocBuilder()
builder.CreateFile("docx")
dstPath = os.getcwd() + "/result.docx"
builder.SaveFile("docx", dstPath)
builder.CloseFile()
builder.CreateFile("docx");