qbd software ltd [UK]
qprinter > moth > qbd software
qPrinter² qcDocument: Properties and Methods
Applies To:
qcDocument
 
See Also:
Templates
DocumentItems
AddTemplateBlock
AddFormatBlock
 

AddTextBlock

Adds a TextBlock to the Document. TextBlocks are small objects that reference the style and formatting information in a Template item.

Syntax

Object.AddTextBlock (Text As String, TemplateKey As Variant, KeepWithNext As Boolean , bUseTemplateKeepNext As Boolean , bVAlignNextItem As Boolean , sKey As String, BeforeObject As Variant, AfterObject As Variant, CalculateSize As Boolean , bUseTemplateVAlign As Boolean )

Parameters
TextThe Text of the to be included in the Document.
TemplateKeyThe Key to identify the Template to be used by the TextBlock.
KeepWithNextEnsures the Item is not seperated from the next Item by a Page Break.
bUseTemplateKeepNextUses the KeepWithNext value set in the Template.
bVAlignNextItemThe Vertical Alignment of the Item. When set to True the Top of the next item in the Document will be at the same vertical position as this Item.
sKeyThe Key to identify the Item.
BeforeObjectThe Index or Key of the Item the new Item should be placed before in the Document order.
AfterObjectThe Index or Key of the Item the new Item should be placed after in the Document order.
CalculateSizeOptional value to indicate whether the Item's size should be calculated. For large documents this can help speed the Preview/Printing process
bUseTemplateVAlignUses the Vertical alignment (VAlignNext) value set in the Template.

Notes

The example creates two Template items and then adds TextBlocks based on the Templates to the document.

Example

Dim qTemplate As qcFormatBlock

' Add a Bold Title Template
qPrint.Document.AddTemplateBlock "Arial", 12, "styleTitle", True, , , , eCentre
Set qTemplate = qPrint.Document.Templates("styleTitle")
' Change the Border for the Title Template
qTemplate.BorderColor = vbBlack
qTemplate.ShowBorder = True
qTemplate.BorderStyle = fbsAll
Set qTemplate = Nothing

' Add a Body style Template
qPrint.Document.AddTemplateBlock "Verdana", 11, "styleBody", , , , , eJustify

' Add information to the Document using the Template styles
qPrint.Document.AddTextBlock "Section 1", "styleTitle"
qPrint.Document.AddTextBlock "The text of the section one.", "styleBody"
qPrint.Document.AddTextBlock "Section 2", "styleTitle"
qPrint.Document.AddTextBlock "The text of the section two.", "styleBody" 

See Also: Templates, DocumentItems, AddTemplateBlock, AddFormatBlock

©2002 qbd software ltd