Previous Document Next Document
TextParagraphs.Item

Property Item(Index As Long, [Count As Long = 1]) As TextRange

Member of TextParagraphs

The Item property returns a TextRange object that contains the specified paragraphs.

The Item property returns a read-only value.

Parameters
Description
Index
Specifies a paragraph by its index number
Count
Specifies the number of paragraphs
This parameter is optional, and its default value is 1.

The following code example creates paragraph text, applies bold formatting to the second paragraph, and fills the fifth and sixth paragraphs with uniform red:

Sub Test() 
 Dim t As Text 
 Dim s As Shape 
 Dim d As Document 
 Dim strText As String 
 strText = "This is a test. This is a test. This is a test. " & _ 
  "This is a test. This is a test. " & vbCr & _ 
  "This is still a test. This is still a test. This is still a test. 
" & _ 
  "This is still a test. This is still a test. " & vbCr & _ 
  "This is a test. This is a test. This is a test. " & _ 
  "This is a test. This is a test. " & vbCr & _ 
  "This is still a test. This is still a test. This is still a test. 
" & _ 
  "This is still a test. This is still a test. " & vbCr & _ 
  "This is a test. This is a test. This is a test. " & _ 
  "This is a test. This is a test. " & vbCr & _ 
  "This is still a test. This is still a test. This is still a test. 
" & _ 
  "This is still a test. This is still a test. " & vbCr & _ 
  "This is a test. This is a test. This is a test. " & _ 
  "This is a test. This is a test. " 
 Set d = CreateDocument 
 Set s = d.ActiveLayer.CreateParagraphText(2, 2, 8, 8, strText) 
 Set t = s.Text 
 t.Story.Paragraphs.Item(2).Bold = True 
 t.Story.Paragraphs.Item(5, 2).Fill.UniformColor.RGBAssign 155, 0, 
0 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.