拆分单词修订到修订不改变应用段落样式

问题描述 投票:0回答:1

有没有办法,我们可以对一套修订的拆分单词修订直接的方式?

如果不能,在这种情况之下,enter image description here这就是my other issue有关。

该文件有几个段落,每个都有自己的应用风格。当把插入修订在上面的例子,我想通过结束标记作为然后它会分裂成三个版本的插入段落修订分开。而解决方案应该是一个全球性的解决方案,它可以是能够申请任何用户做任何插入。例如 :

  • 插入可以包含在它结束标记任意数量的段落。
  • 插入可以用一个段落的结束标记开始
  • 段落已申请独立的段落样式,我们需要让他们保持不变。

这是我已经修改了代码,我试图分开第一款和其他段落。但是,我已经陷在逻辑部分。

Private Function RemoveParagraphEndingsFromRevisions(ByRef WordRange As Word.Range)
On Error GoTo ErrorHandler

Dim fTrackRevisions As Boolean
Dim objRevision As Word.Revision
Dim objRange1, objRange2 As Word.Range
Dim sPara, firstParaStyle As String
Dim stylesCollection As VBA.Collection
Dim count As Long

Set stylesCollection = New VBA.Collection
sPara = vbCr
With WordRange.Document
    fTrackRevisions = .TrackRevisions
    .TrackRevisions = False
End With

For Each objRevision In WordRange.Document.Revisions
    'AllowTrackChangesForInsertion method checks whether the revision contains a text change
    If AllowTrackChangesForInsertion(objRevision) = True Then
        'If there are paragraph ending marks within the revision
        If InStr(objRevision.Range.Text, sPara) > 0 Then
            Set objRange1 = objRevision.Range.Duplicate
            Set objRange2 = objRange1.Duplicate

            firstParaStyle = objRange2.Paragraphs(1).Style

            If (objRange1.Paragraphs.count > 1) Then
                count = 2
                Do While (count < objRange1.Paragraphs.count + 1)
                    stylesCollection.Add objRange1.Paragraphs(count).Style
                    count = count + 1
                Loop

                .........

            Else
                'When there's no inserted text after inserted end para mark
            End If

        End If
    End If
Next

ErrorHandler:
    WordRange.Document.TrackRevisions = fTrackRevisions
    Set objRevision = Nothing
    Set objRange1 = Nothing
    Set objRange2 = Nothing
    Set stylesCollection = Nothing
    Select Case Err.Number
        Case 0
        Case Else
            ShowUnexpectedError ErrorSource:="RemoveParasFromRevisions" & vbCr & Err.Source
    End Select
End Function

有谁请帮助我。

谢谢。

vba ms-word
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.