#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnGetTextRTF(hObject, uFormat, pText, puLen)
Gets the text and text length (unformatted text or rich text) of an ANNOBJECT_RTF or ANNOBJECT_AUTOMATION annotation object.
Handle to the ANNOBJECT_RTF object.
Value that specifies the text format type. Possible values are:
Value | Meaning |
---|---|
RTFFORMAT_TEXT | [0x0001] Retrieve the text as unformatted text. |
RTFFORMAT_RTF | [0x0002] Retrieve the text as rich text. |
Pointer to a character string to be updated with the annotation object's character string. This value can be NULL.
Address of the variable to be updated with the length of the object's character string.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function is used to retrieve the text from an ANNOBJECT_RTF or ANNOBJECT_AUTOMATION object. The text can be retrieved either as rich text, or unformatted text.
Call this function twice. On the first call, pass NULL for the pText
argument to get length of the required input buffer. Then, allocate a buffer and call the function a second time to retreive the text. The following code snippet illustrates the process:
HANNOBJECT hObject; // assume this is a valid ANNOBJECT_RTF object
L_UINT uLength;
L_TCHAR *pText;
// Get the length
L_AnnGetTextRTF( hObject, RTFFORMAT_RTF, NULL, &uLength);
// Allocate a buffer
pText = (L_TCHAR *)malloc ( (uLength+1) * sizeof (L_TCHAR) );
// Retrieve the text
L_AnnGetTextRTF( hObject, RTFFORMAT_RTF, pText, &uLength);
To get or set the text of other text objects, see the documentation for L_AnnGetTextLen, L_AnnGetText and L_AnnSetText.
Required DLLs and Libraries
Win32, x64.
This sample gets the text from Rich Text annotation object in one of two formats (text, or rich text)
hObject: the Rich Text annotation object
uFormat: the format of the retrieved text--one of
RTFFORMAT_TEXT
RTFFORMAT_RTF
L_INT AnnGetTextRTFExample(HANNOBJECT hObject,
L_UINT uFormat)
{
L_INT nRet;
L_SIZE_T zLength;
L_TCHAR* pText;
L_TCHAR szMsg[200];
L_TCHAR* pszFormat;
switch(uFormat)
{
case RTFFORMAT_TEXT:
pszFormat = TEXT("RTFFORMAT_TEXT");
break;
case RTFFORMAT_RTF:
pszFormat = TEXT("RTFFORMAT_RTF");
break;
default:
return 0;
break;
}
// Get the length
nRet = L_AnnGetTextRTF( hObject, uFormat, NULL, &zLength);
if (nRet != SUCCESS)
return nRet;
pText = (L_TCHAR *)malloc( (zLength + 1) * sizeof(L_TCHAR) );
nRet = L_AnnGetTextRTF( hObject, uFormat, pText, &zLength);
if (nRet == SUCCESS)
{
wsprintf(szMsg, TEXT("Format: %s\nLength: %d"), pszFormat, zLength);
MessageBox(NULL, szMsg, TEXT("L_AnnGetTextRTF")/*pText, szMsg*/, MB_OK);
}
else
{
return nRet;
}
free(pText);
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document