Skip to main content

CreateFile

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

Syntax

HRESULT CreateFile([in] BSTR type, [out, retval] VARIANT_BOOL* result);

Parameters

NameTypeDescription
typeBSTRThe file extension. The following values are possible: docx, xlsx, pptx, or pdf (see OFFICESTUDIO_FILE_XXX values).
resultVARIANT_BOOL*Specifies if the operation of creating a file is successful or not.

Example

COM

CoInitialize(NULL);
IONLYOFFICEDocBuilder* oBuilder = NULL;
VARIANT_BOOL b;
oBuilder->Initialize();
oBuilder->CreateFile(_bstr_t("docx"), &b);
oBuilder->Dispose();

.docbuilder

builder.CreateFile("docx")