CreateFile

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

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

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")

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).