IsStyleSeparator 属性

       

如果为 True,则段落包含特殊隐藏段落标记,利用该标记 Microsoft Word 可以显示合并不同段落样式的段落。Boolean 类型,只读。

expression.IsStyleSeparator

expression   必需。该表达式返回一个 Paragraph 对象。

示例

本示例为包含内置“Normal”样式的样式分隔符的所有段落设置格式。

Sub StyleSep()
    Dim pghDoc As Paragraph
    For Each pghDoc In ThisDocument.Paragraphs
        If pghDoc.IsStyleSeparator = True Then
            pghDoc.Range.Select
            Selection.Style = "Normal"
        End If
    Next pghDoc
End Sub

本示例在每个样式分隔符后添加一个段落,然后删除样式分隔符。

Sub RemoveStyleSeparator()
    Dim pghDoc As Paragraph
    Dim styName As String

    'Loop through all paragraphs in document to check if it is a style
    'separator. If it is, delete it and enter a regular paragraph
    For Each pghDoc In ThisDocument.Paragraphs
        If pghDoc.IsStyleSeparator = True Then
            pghDoc.Range.Select
            With Selection
                .Collapse (wdCollapseEnd)
                .TypeParagraph
                .MoveLeft (1)
                .TypeBackspace
            End With
        End If
    Next pghDoc
End Sub