Index

C/C++ Functions

txTextCopy

DT_SWORD txTextCopy(DT_TXDOC text_doc, DT_UBYTE* buffer, DT_SLONG max_buffer_len, DT_ID_SWORD buffer_format)

Short Description: Copy plain text to user-supplied buffer

This function extracts plain text from the active text selection and copies it to a user-supplied memory buffer.

Parameters

ParameterDescription

text_doc

Handle of the associated text document instance.

buffer

A valid pointer to a user-supplied memory buffer to which the function will copy the plain text.

max_buffer_len

Size of the user-supplied buffer, i.e. the maximum number of bytes (not characters) that can be stored in the buffer.

Applications can use the txTextGetSelectSize function to determine the total number of characters in all the active text selection(s). This makes it possible to easily calculate the required max_buffer_len value.

buffer_format

Specifies how the plain text is to be stored in the buffer. Can be one of the following:

TX_BUFFER_FORMAT_1  1   /* 1 byte per character — for ANSI */ 
TX_BUFFER_FORMAT_2  2   /* 2 bytes per character — for UCS2 */ 
TX_BUFFER_FORMAT_3  3   /* 3 bytes per character */ 
TX_BUFFER_FORMAT_4  4   /* 4 bytes per character — for UCS4 */ 

These values have the following meaning:

  • TX_BUFFER_FORMAT_1 indicates that the size of each character in the buffer will be 1 byte. All characters will have codepoints in the 0 - 255 range.

  • TX_BUFFER_FORMAT_2 indicates that the size of each character in the buffer will be 2 bytes (little endian byte ordering). All characters will have codepoints in the 0 - 65,535 range.

  • TX_BUFFER_FORMAT_3 indicates that the size of each character in the buffer will be 3 bytes (little endian byte ordering). All characters will have codepoints in the 0 - 16,777,215 range.

  • TX_BUFFER_FORMAT_4 indicates that the size of each character in the buffer will be 4 bytes (little endian byte ordering). All characters will have codepoints in the 0 - 4,294,967,295 range.

Return Value

If the function was successful, the return value is 1. Otherwise, the function returns 0.

 

Index