VpeWriteTextBlock

<< Click to Display Table of Contents >>

Navigation:  Text Block Object >

VpeWriteTextBlock

Previous pageReturn to chapter overviewNext page

[Not supported by the Community Edition]

Outputs a portion of text from the beginning of a Text Block Object, with the specified number of text lines, according to the current width and font properties.

When you output a portion of a Text Block Object, the text is removed from the Text Block Object. With successive calls to this method, you can continue to output the next part in another column or on another page.

VpeCoord VpeWriteTextBlock(

VpeHandle hDoc

VpeHandle hTextBlock,

VpeCoord Left,

VpeCoord Top,

int nLineCount

)

VpeHandle hDoc

Document Handle

VpeHandle hTextBlock

handle of the Text Block Object

VpeCoord Left, Top

position where the text shall be placed in the document

int nLineCount

the number of text lines, which shall be placed in the document

Returns:

The bottom coordinate of the inserted text.

Remarks:

Prior to calling this function, you need to call VpeTextBlockSetWidth() at least once.

 

VpeTextBlockSetWidth() causes to retrigger the rendering. If the font attributes (e.g. font size) for plain text are changed, you need to call VpeTextBlockSetWidth() to re-render the Text Block Object. This does only apply to the Professional Edition and higher. Lower editions will use the font, pen, etc. properties at the time when VpeCreateTextBlock() is called. RTF will also ignore changes of font properties.

 

The AutoBreakMode, PenSize and Rotation are not in effect, neither for plain text, nor for RTF.

 

Differences in values returned by VpeTextBlockGetHeight() and VpeTextBlockGetRangeHeight() compared to VpeWriteTextBlock(), Render() and other text output functions: Due to historical reasons (16-bit), Print(), Write() and Render() add a small offset to the bottom coordinate of a text object. For compatibilty, VpeWriteTextBlock() does the same. If you wish to place parts of a text block object consecutively below each other, use the values of VpeTextBlockGetHeight() or VpeTextBlockGetRangeHeight() to compute the top coordinate of the next block.

 

Rich Text (RTF):

Paragraph spacing properties do not work, because for each newly inserted partial text block

the renderer must assume that it is the first line of the first paragraph. As a result the FirstIndent and SpaceBefore are applied to each partial text block, and SpaceBetween and SpaceAfter are ignored. As a rule of thumb, there should not be any paragraph spacing settings applied to Rich Text, which is used for Text Block Objects.

Example:

The source codes shipped with VPE contain detailed example code for many different programming languages like C#, Delphi, Java, C/C++, etc.

 

For using plain text with a Text Block Object, please see the 'vpedemo' source codes.

 

For using Rich Text (RTF) with a Text Block Object, please see the 'vppdemo' source codes.