WriteTextBlock

<< Click to Display Table of Contents >>

Navigation:  Text Block Object >

WriteTextBlock

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 VPE.WriteTextBlock(

TextBlock TextBlock,

VpeCoord Left,

VpeCoord Top,

int nLineCount

)

TextBlock TextBlock

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 assign a value to TextBlock.Width at least once.

 

Assigning a value to TextBlock.Width causes to retrigger the rendering. If the font attributes (e.g. font size) for plain text are changed, you need to assign a value to TextBlock.Width 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 CreateTextBlock() 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 TextBlock.Height and TextBlock.GetRangeHeight() compared to WriteTextBlock(), 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, WriteTextBlock() does the same. If you wish to place parts of a text block object consecutively below each other, use the values of TextBlock.Height or TextBlock.GetRangeHeight() 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.