Table of contents
TOC
Collapse the table of content
Expand the table of content

ParagraphFormat Object (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

Represents all the formatting for a paragraph.

Example

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

Methods

Name
Duplicate
Reset
SetLineSpacing
SetListType

Properties

Name
Alignment
Application
AttachedToText
CharBasedFirstLineIndent
FirstLineIndent
KashidaPercentage
KeepLinesTogether
KeepWithNext
LeftIndent
LineSpacing
LineSpacingRule
ListBulletFontName
ListBulletFontSize
ListBulletText
ListIndent
ListNumberSeparator
ListNumberStart
ListType
LockToBaseLine
Parent
RightIndent
SpaceAfter
SpaceBefore
StartInNextTextBox
Tabs
TextDirection
TextStyle
UseCharBasedFirstLineIndent
WidowControl
© 2018 Microsoft