# ParagraphFormat 对象

代表段落的所有格式。

## 说明


使用 **Format** 属性可返回一个或多个段落的 **ParagraphFormat** 对象。 **ParagraphFormat** 属性返回所选内容、范围、样式、 **Find** 对象或 **Replacement** 对象的 **ParagraphFormat** 对象。


## 示例


```JavaScript
/*本示例将活动文档中的第三个段落居中。*/
function test() {
    ActiveDocument.Paragraphs.Item(3).Format.Alignment = wdAlignParagraphCenter
}
```


```JavaScript
/*本示例查找所选内容之后的下一个 2 倍行距的段落。*/
function test() {
    let find = Selection.Find
    find.ClearFormatting()
    find.ParagraphFormat.LineSpacingRule = wdLineSpaceDouble
    find.Text = ""
    find.Forward = true
    find.Wrap = wdFindContinue
    Selection.Find.Execute()
}
```


```JavaScript
/*本示例为活动文档的第一个段落设置段落格式。*/
function test() {
    let paragraphFormat = ActiveDocument.Paragraphs.Item(1).Format
    paragraphFormat.Alignment = wdAlignParagraphCenter
    paragraphFormat.Borders.Enable = msoTrue
}
```
可以使用 **Duplicate** 属性创建现有 **ParagraphFormat** 对象的独立副本。



```JavaScript
/*本示例复制活动文档中第一个段落的段落格式，并将格式存储在 paragraphFormat 中，然后将 paragraphFormat 的左缩进更改为 1 英寸，创建一个新文档，将文本插入到文档中，并将 paragraphFormat 的段落格式应用于该文本。*/
function test() {
    let paragraphFormat = ActiveDocument.Paragraphs.Item(1).Format.Duplicate
    paragraphFormat.LeftIndent = InchesToPoints(1)
    Documents.Add()
    Selection.InsertAfter("This is a new paragraph.")
    Selection.Paragraphs.Format = paragraphFormat
}
```

{#objmember}

## 方法

| **名称** | **说明** |
| :------ | :------- |
| [CloseUp](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/CloseUp) | 删除指定段落格式中段落前的任何间距。 |
| [IndentCharWidth](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/IndentCharWidth) | 将一个或多个段落缩进指定的字符数。 |
| [IndentFirstLineCharWidth](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/IndentFirstLineCharWidth) | 将一个或多个段落的首行缩进指定的字符数。 |
| [OpenOrCloseUp](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/OpenOrCloseUp) | 切换指定段落的段前间距。 |
| [OpenUp](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/OpenUp) | 为指定段落设置 12 磅的段前间距。 |
| [Reset](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Reset) | 删除手动段落格式（不使用样式应用的格式）。 |
| [Space1](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Space1) | 为指定段落设置单倍行距。 |
| [Space15](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Space15) | 为指定段落设置 1.5 倍行距。 |
| [Space2](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Space2) | 为指定段落设置 2 倍行距。 |
| [TabHangingIndent](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/TabHangingIndent) | 将悬挂缩进量设置为指定的制表位数。 |
| [TabIndent](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/TabIndent) | 将指定段落的左缩进量设置为指定的制表位数。 |
## 属性

| **名称** | **说明** |
| :------ | :------- |
| [AddSpaceBetweenFarEastAndAlpha](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/AddSpaceBetweenFarEastAndAlpha) | 如果 WPS 将自动在指定段落的日文和拉丁文文字之间添加空格，则该属性值为 **msoTrue** 。如果仅对于某些指定段落将该属性设置为 **msoTrue** ，则该属性会返回 **wdUndefined** 。 **Long** 类型，可读写。 |
| [AddSpaceBetweenFarEastAndDigit](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/AddSpaceBetweenFarEastAndDigit) | 如果 WPS 将自动在指定段落的日文文字和数字之间添加空格，则该属性值为 **msoTrue** 。如果仅对于某些指定段落将该属性设置为 **msoTrue** ，则该属性会返回 **wdUndefined** 。 **Long** 类型，可读写。 |
| [Alignment](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Alignment) | 返回或设置一个 **WdParagraphAlignment** 常量，该常量代表指定段落的对齐方式，可读写。 |
| [Application](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Application) | 返回一个代表 WPS 应用程序的 **Application** 对象。 |
| [AutoAdjustRightIndent](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/AutoAdjustRightIndent) | 如果 WPS 会根据您指定的每行字符数自动调整指定段落的右缩进，则该属性值为 **msoTrue** 。如果只将某些指定段落的 **AutoAdjustRightIndent** 属性设置为 **msoTrue** ，则该属性会返回 **wdUndefined** 。 **Long** 类型，可读写。 |
| [BaseLineAlignment](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/BaseLineAlignment) | 返回或设置一个 **WdBaselineAlignment** 常量，该常量代表行中字体的垂直位置，可读写。 |
| [Borders](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Borders) | 返回一个 **Borders** 集合，该集合代表指定对象的所有边框。 |
| [CharacterUnitFirstLineIndent](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/CharacterUnitFirstLineIndent) | 返回或设置首行或悬挂缩进的值（以字符为单位）。用正值设置首行缩进，用负值设置悬挂缩进。 **Single** 类型，可读写。 |
| [CharacterUnitLeftIndent](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/CharacterUnitLeftIndent) | 该属性返回或设置指定段落的左缩进量（以字符为单位）。 **Single** 类型，可读写。 |
| [CharacterUnitRightIndent](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/CharacterUnitRightIndent) | 该属性返回或设置指定段落的右缩进量（以字符为单位）。 **Single** 类型，可读写。 |
| [CollapsedByDefault](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/CollapsedByDefault) | 返回或设置指定的段落格式是否默认折叠。可读/写 **Long** 类型。 |
| [Creator](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Creator) | 返回一个 32 位整数，该整数代表在其中创建特定对象的应用程序。只读 **Long** 类型。 |
| [DisableLineHeightGrid](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/DisableLineHeightGrid) | 如果该属性的值为 **msoTrue** ，则当指定每页的行数时，WPS 会将指定段落中的字符与行网格对齐。如果只将某些指定段落的 **DisableLineHeightGrid** 属性设置为 **msoTrue** ，则返回 **wdUndefined** 。 **Long** 类型，可读写。 |
| [Duplicate](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Duplicate) | 返回一个只读 **ParagraphFormat** 对象，该对象代表指定段落的段落格式。 |
| [FarEastLineBreakControl](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/FarEastLineBreakControl) | 如果为 **msoTrue** ，则 WPS 会将东亚语言文字的换行规则应用于指定的段落。如果只将某些指定段落的 **FarEastLineBreakControl** 属性设定为 **msoTrue** ，则返回 **wdUndefined** 。 **Long** 类型，可读写。 |
| [FirstLineIndent](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/FirstLineIndent) | 返回或设置首行缩进或悬挂缩进的大小（以磅值表示）。用正数设置首行缩进的尺寸，用负数设置悬挂缩进的尺寸。 **Single** 类型，可读写。 |
| [HalfWidthPunctuationOnTopOfLine](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/HalfWidthPunctuationOnTopOfLine) | 如果为 **msoTrue** ，则 WPS 会将指定段落行首的标点符号改为半角字符。如果仅将某些指定段落的该属性设置为 **msoTrue** ，则此属性将返回 **wdUndefined** 。 **Long** 类型，可读写。 |
| [HangingPunctuation](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/HangingPunctuation) | 如果为 **msoTrue** ，则指定段落中的标点将可以溢出边界。如果仅将某些指定段落的该属性设置为 **msoTrue** ，则返回 **wdUndefined** 。 **Long** 类型，可读写。 |
| [Hyphenation](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Hyphenation) | 如果指定的段落进行自动断字，则该属性值为 **msoTrue** 。如果指定的段落不进行自动断字，则该属性值为 **msoFalse** 。可读写 **Long** 类型。 |
| [KeepTogether](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/KeepTogether) | 在 WPS 对文档重新分页时，如果指定段落中的所有行都位于同一页上，则该属性值为 **msoTrue** 。可读写 **Long** 类型。 |
| [KeepWithNext](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/KeepWithNext) | 在 WPS 对文档重新分页时，如果指定段落与它的下一段位于同一页上，则该属性值为 **msoTrue** 。可读写 **Long** 类型。 |
| [LeftIndent](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/LeftIndent) | 返回或设置一个 **Single** 类型的值，该值代表指定段落格式的左缩进值（以磅为单位）。可读写。 |
| [LineSpacing](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/LineSpacing) | 返回或设置指定段落的行距（以磅为单位）。 **Single** 类型，可读写。 |
| [LineSpacingRule](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/LineSpacingRule) | 返回或设置指定段落格式的行距。可读写 **[WdLineSpacing](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/enum/WdLineSpacing)** 类型。 |
| [LineUnitAfter](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/LineUnitAfter) | 返回或设置指定段落的段后间距（以网格线为单位）。可读写 **Single** 类型。 |
| [LineUnitBefore](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/LineUnitBefore) | 返回或设置指定段落的段前间距（以网格线为单位）。可读写 **Single** 类型。 |
| [MirrorIndents](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/MirrorIndents) | 返回或设置一个 **Long** 类型的值，该值代表左缩进和右缩进的宽度是否相同。该属性值可以是 **msoTrue** 、 **msoFalse** 或 **wdUndefined** 。可读写。 |
| [NoLineNumber](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/NoLineNumber) | 如果取消指定段的行号，则该属性值为 **msoTrue** 。该属性值可以是 **msoTrue** 、 **msoFalse** 或 **wdUndefined** 。可读写 **Long** 类型。 |
| [OutlineLevel](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/OutlineLevel) | 返回或设置指定段落的大纲级别。可读写 **[WdOutlineLevel](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/enum/WdOutlineLevel)** 类型。 |
| [PageBreakBefore](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/PageBreakBefore) | 如果在指定段落前插入了分页符，则该属性值为 **msoTrue** 。该属性值可以是 **msoTrue** 、 **msoFalse** 或 **wdUndefined** 。可读写 **Long** 类型。 |
| [Parent](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Parent) | 返回一个 **Object** 类型值，该值代表指定 **ParagraphFormat** 对象的父对象。 |
| [ReadingOrder](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/ReadingOrder) | 返回或设置指定段落的读取次序而不改变其对齐方式。可读写 **WdReadingOrder** 类型。 |
| [RightIndent](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/RightIndent) | 返回或设置指定段落的右缩进量（以磅为单位）。可读写 **Single** 类型。 |
| [Shading](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Shading) | 返回一个 **[Shading](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/Shading/obj)** 对象，该对象代表指定对象的底纹格式。 |
| [SpaceAfter](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/SpaceAfter) | 返回或设置指定段落或文本栏后面的间距（以磅为单位）。可读/写 **Single** 类型。 |
| [SpaceAfterAuto](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/SpaceAfterAuto) | 如果 WPS 自动设置指定段落的段后间距，则该属性为 **msoTrue** 。可读/写 **Long** 类型。 |
| [SpaceBefore](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/SpaceBefore) | 返回或设置指定段落的段前间距（以磅为单位）。可读/写 **Single** 类型。 |
| [SpaceBeforeAuto](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/SpaceBeforeAuto) | 如果 WPS 自动设置指定段落的段前间距，则该属性为 **msoTrue** 。可读/写 **Long** 类型。 |
| [Style](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/Style) | 返回或设置指定对象的样式。可读写 **Variant** 类型。 |
| [TabStops](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/TabStops) | 返回或设置一个 **TabStops** 集合，该集合代表指定段落中的所有自定义制表位。可读写。 |
| [TextboxTightWrap](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/TextboxTightWrap) | 返回或设置一个 **[WdTextboxTightWrap](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/enum/WdTextboxTightWrap)** 常量，该常量代表文本环绕形状或文本框的紧密程度。可读写。 |
| [WidowControl](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/WidowControl) | 在 WPS 对文档重新分页时，如果指定段落的首行和末行与段落的其他各行同页，则该属性值为 **msoTrue** 。该属性值可以是 **msoTrue** 、 **msoFalse** 或 **wdUndefined** 。可读写 **Long** 类型。 |
| [WordWrap](/app-integration-dev/wps365/client/wpsoffice/jsapi/wps/ParagraphFormat/member/WordWrap) | 如果 WPS 在指定段落或文本框架的西文单词中间断字换行，则该属性值为 **msoTrue** 。可读写 **Long** 类型。 |