OpenFile

int OpenFile(sPath: const wchar_t*, sParams: const wchar_t*)

Description

Opens the document file which will be edited and saved afterwards.

Parameters

sPathconst wchar_t*

The path to the file to be opened together with its name and extension.

sParamsconst wchar_t*

The parameters needed for the correct file opening (most commonly, the encoding is used for the txt and csv file types or the delimiter for the csv files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where m_nCsvTxtEncoding is used for the text encoding and m_nCsvDelimiter is used for the delimiter. You can find all the supported values for the encoding in this file. The supported values for the csv delimiters include:

  • 0 - no delimiter;
  • 1 - tab;
  • 2 - semicolon;
  • 3 - colon;
  • 4 - comma;
  • 5 - space.

Example

C++

std::wstring sWorkDirectory = NSUtils::GetBuilderDirectory();
CDocBuilder::Initialize(sWorkDirectory.c_str());
CDocBuilder oBuilder;
oBuilder.OpenFile(L"text-document.csv", "<m_nCsvTxtEncoding>46</m_nCsvTxtEncoding><m_nCsvDelimiter>4</m_nCsvDelimiter>");
CDocBuilder::Dispose();

.docbuilder

builder.OpenFile("text-document.csv", "<m_nCsvTxtEncoding>46</m_nCsvTxtEncoding><m_nCsvDelimiter>4</m_nCsvDelimiter>")

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