SetTmpFolder
Sets the path to the folder where the program will temporarily save files needed for the program correct work. After the successful document file creation, all the files will be deleted from the folder. If no temporary folder is set, the system one will be used.
Syntax
- Python
- C++
- COM
- Java
- .Net
- JS
def SetTmpFolder(self, folder: str)
void SetTmpFolder(const wchar_t* sFolder);
HRESULT SetTmpFolder([in] BSTR folder);
void setTmpFolder(String folder);
void SetTmpFolder(String^ sFolder);
SetTmpFolder(folder)
Parameters
- Python
- C++
- COM
- Java
- .Net
- JS
| Name | Type | Description |
|---|---|---|
| folder | str | The path to the folder where the temporary files will be saved. |
| Name | Type | Description |
|---|---|---|
| sFolder | const wchar_t* | The path to the folder where the temporary files will be saved. |
| Name | Type | Description |
|---|---|---|
| folder | BSTR | The path to the folder where the temporary files will be saved. |
| Name | Type | Description |
|---|---|---|
| folder | String | The path to the folder where the temporary files will be saved. |
| Name | Type | Description |
|---|---|---|
| sFolder | String^ | The path to the folder where the temporary files will be saved. |
| Name | Type | Description |
|---|---|---|
| folder | String | The path to the folder where the temporary files will be saved. |
Example
- Python
- C++
- COM
- Java
- .Net
- JS
import os
import docbuilder
builder = docbuilder.CDocBuilder()
builder.SetTmpFolder("DocBuilderTemp")
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.SetTmpFolder(L"DocBuilderTemp");
CDocBuilder::Dispose();
CoInitialize(NULL);
IONLYOFFICEDocBuilder* oBuilder = NULL;
oBuilder->SetTmpFolder("DocBuilderTemp");
oBuilder->Dispose();
CDocBuilder.initialize("");
CDocBuilder builder = new CDocBuilder();
builder.setTmpFolder("DocBuilderTemp");
CDocBuilder.dispose();
string workDirectory = "C:/Program Files/ONLYOFFICE/documentBuilder";
CDocBuilder.Initialize(workDirectory);
CDocBuilder oBuilder = new CDocBuilder();
oBuilder.SetTmpFolder("DocBuilderTemp");
CDocBuilder.Destroy();
builder.SetTmpFolder("DocBuilderTemp");
builder.CreateFile("docx");
builder.SaveFile("docx", "result.docx");
builder.CloseFile();