OpenFile
HRESULT OpenFile(path: [in] BSTR, params: [in] BSTR, result: [out, retval] VARIANT_BOOL*)
Description
Opens the document file which will be edited and saved afterwards.
Parameters
- path
BSTR
The path to the file to be opened together with its name and extension.
- params
BSTR
The parameters needed for the correct file opening (most commonly, the encoding is used for the
txt
andcsv
file types or the delimiter for thecsv
files, for other file types this is just an empty string). The parameters are added in the form of XML tags, wherem_nCsvTxtEncoding
is used for the text encoding andm_nCsvDelimiter
is used for the delimiter. You can find all the supported values for the encoding in this file. The supported values for thecsv
delimiters include:0
- no delimiter;1
- tab;2
- semicolon;3
- colon;4
- comma;5
- space.
- result
VARIANT_BOOL*
Specifies if the operation of opening a file is successful or not.
Example
COM
CoInitialize(NULL);
IONLYOFFICEDocBuilder* oBuilder = NULL;
VARIANT_BOOL b;
oBuilder->Initialize();
oBuilder->OpenFile("text-document.csv", "<m_nCsvTxtEncoding>46</m_nCsvTxtEncoding><m_nCsvDelimiter>4</m_nCsvDelimiter>", &b);
oBuilder->Dispose();
.docbuilder
builder.OpenFile("text-document.csv", "<m_nCsvTxtEncoding>46</m_nCsvTxtEncoding><m_nCsvDelimiter>4</m_nCsvDelimiter>")