|
|
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 | | Text | The Text of the to be included in the Document. | | TemplateKey | The Key to identify the Template to be used by the TextBlock. | | KeepWithNext | Ensures the Item is not seperated from the next Item by a Page Break. | | bUseTemplateKeepNext | Uses the KeepWithNext value set in the Template. | | bVAlignNextItem | The 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. | | sKey | The Key to identify the Item. | | BeforeObject | The Index or Key of the Item the new Item should be placed before in the Document order. | | AfterObject | The Index or Key of the Item the new Item should be placed after in the Document order. | | CalculateSize | Optional value to indicate whether the Item's size should be calculated. For large documents this can help speed the Preview/Printing process | | bUseTemplateVAlign | Uses 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
|