CreateTypedArray

CDocBuilderValue CreateTypedArray(sBuffer: unsigned char*, nLength: const int&, bExternalize: const bool&)

Description

Creates a Uint8Array value, an analogue of Uint8Array in JS.

Please note, that for the .docbuilder file the CDocBuilderContext.CreateTypedArray method is not used.

Parameters

sBufferunsigned char*
The array buffer.
nLengthconst int&
The array length.
bExternalizeconst bool&
Specifies if the application releases the memory after freeing Uint8Array (true). If this parameter is false, then the memory will be released automatically. In this case, the buffer must be created with the AllocMemoryTypedArray method.

Example

C++

std::wstring sWorkDirectory = NSUtils::GetBuilderDirectory();
CDocBuilder::Initialize(sWorkDirectory.c_str());
CDocBuilder oBuilder;
CContext oContext = oBuilder.GetContext();
unsigned char* sBuffer = oContext.AllocMemoryTypedArray(1500);
CValue oTypedArray = oContext.CreateTypedArray(sBuffer, 3, false);
CDocBuilder::Dispose();

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