CloseFile
Closes the file to stop working with it. You can use a single ONLYOFFICE Document Builder instance to work with all your files, but you need to close the previous file before you can start working with the next one in this case.
Syntax
- Python
- C++
- COM
- Java
- .Net
- JS
def CloseFile(self)
void CloseFile();
HRESULT CloseFile();
void closeFile();
void CloseFile();
CloseFile()
Example
- Python
- C++
- COM
- Java
- .Net
- JS
import os
import docbuilder
builder = docbuilder.CDocBuilder()
builder.CreateFile("docx")
dstPath = os.getcwd() + "/result.docx"
builder.SaveFile("docx", dstPath)
builder.CloseFile()
std::wstring sWorkDirectory = NSUtils::GetBuilderDirectory();
CDocBuilder::Initialize(sWorkDirectory.c_str());
CDocBuilder oBuilder;
oBuilder.CloseFile();
CDocBuilder::Dispose();
CoInitialize(NULL);
IONLYOFFICEDocBuilder* oBuilder = NULL;
oBuilder->Initialize();
oBuilder->CloseFile();
oBuilder->Dispose();
CDocBuilder.initialize("");
CDocBuilder builder = new CDocBuilder();
builder.closeFile();
CDocBuilder.dispose();
string workDirectory = "C:/Program Files/ONLYOFFICE/documentBuilder";
CDocBuilder.Initialize(workDirectory);
CDocBuilder oBuilder = new CDocBuilder();
oBuilder.CloseFile();
CDocBuilder.Destroy();
builder.CreateFile("docx");
builder.SaveFile("docx", "result.docx");
builder.CloseFile();