Skip to main content

CreateFile

Creates a new file. The type of the file which will be created needs to be set.

Syntax

def CreateFile(self, type: int | str) -> bool

Parameters

NameTypeDescription
typeint | strThe file type as a hexadecimal integer (OFFICESTUDIO_FILE_XXX values) or a string (docx, xlsx, pptx, pdf).

Example

import os
import docbuilder

builder = docbuilder.CDocBuilder()
builder.CreateFile("docx")

dstPath = os.getcwd() + "/result.docx"
builder.SaveFile("docx", dstPath)
builder.CloseFile()