ParagraphFormat Object [Publisher 2003 VBA Language Reference]
Multiple objects ParagraphFormat TabStops |
Represents all the formatting for a paragraph.
Using the ParagraphFormat Object
Use the ParagraphFormat property to return the ParagraphFormat object for a paragraph or paragraphs. The ParagraphFormat property returns the ParagraphFormat object for a selection, range, or style. The following example centers the paragraph at the cursor position. This example assumes that the first shape is a text box and not another type of shape.
Sub CenterParagraph()
Selection.TextRange.ParagraphFormat _
.Alignment = pbParagraphAlignmentCenter
End Sub
Use the Duplicate property to copy an existing ParagraphFormat object. The following example duplicates the paragraph formatting of the first paragraph in the active publication and stores the formatting in a variable. This example duplicates an existing ParagraphFormat object and then changes the left indent to one inch, creates a new textbox, inserts text into it, and applies the paragraph formatting of the duplicated paragraph format to the text.
Sub DuplicateParagraphFormating()
Dim pfmtDup As ParagraphFormat
Set pfmtDup = ActiveDocument.Pages(1).Shapes(1).TextFrame _
.TextRange.ParagraphFormat.Duplicate
pfmtDup.LeftIndent = Application.InchesToPoints(1)
With ActiveDocument.Pages.Add(Count:=1, After:=1)
With .Shapes.AddTextbox(pbTextOrientationHorizontal, _
Left:=72, Top:=72, Width:=200, Height:=100)
With .TextFrame.TextRange
.Text = "This is a test of how to use " & _
"the ParagraphFormat object."
.ParagraphFormat = pfmtDup
End With
End With
End With
End Sub
Properties | Alignment Property | Application Property | AttachedToText Property | CharBasedFirstLineIndent Property | FirstLineIndent Property | KashidaPercentage Property | KeepLinesTogether Property | KeepWithNext Property | LeftIndent Property | LineSpacing Property | LineSpacingRule Property | ListBulletFontName Property | ListBulletFontSize Property | ListBulletText Property | ListIndent Property | ListNumberSeparator Property | ListNumberStart Property | ListType Property | LockToBaseLine Property | Parent Property | RightIndent Property | SpaceAfter Property | SpaceBefore Property | StartInNextTextBox Property | Tabs Property | TextDirection Property | TextStyle Property | UseCharBasedFirstLineIndent Property | WidowControl Property
Methods | Duplicate Method | Reset Method | SetLineSpacing Method | SetListType Method
Parent Objects | TextRange Object | TextStyle Object
Child Objects | TabStops Object