Previous Document Next Document
TextFrame.Container

Property Container As Shape

Member of TextFrame

The Container property returns a reference to the frame’s container.

The Container property returns a read-only value.

The following code example links frames of paragraph text. It places the first paragraph text inside an ellipse and the second inside a rectangle. The index number of each frame inside a container is then displayed.

Sub Test() 
 Dim s As Shape 
 Dim s1 As Shape 
 Dim s2 As Shape 
 Dim s3 As Shape 
 Dim t As Text 
 Dim f As TextFrame 
 Dim d As Document 
 Set d = CreateDocument 
 Set s = d.ActiveLayer.CreateParagraphText(2, 2, 5, 5, String$(1000, 
"Z")) 
 Set s1 = d.ActiveLayer.CreateParagraphText(5, 5, 8, 8) 
 Set s2 = d.ActiveLayer.CreateEllipse(8, 8, 10, 10) 
 Set s3 = d.ActiveLayer.CreateRectangle(1, 1, 4, 4) 
 Set t = s.Text 
 ' Link the frames together 
 t.Frame.LinkTo s1 
 ' Place the text inside the shapes 
 s2.PlaceTextInside s 
 s3.PlaceTextInside s1 
 ' Go through the frames 
 For Each f In t.Frames 
  If f.IsInsideContainer = True Then 
   Select Case f.Container.Type 
    Case 1 
     MsgBox "Frame " & f.Index & " is inside a rectangle" 
    Case 2 
     MsgBox "Frame " & f.Index & " is inside a ellipse" 
    Case Else 
     MsgBox "Frame " & f.Index & " is inside a shape" 
   End Select 
  End If 
 Next f 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.