text 删除页码

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 删除页码相关的知识,希望对你有一定的参考价值。

Sub sanweishu()
selection.HomeKey wdStory
With selection.Find
    .Text = " ([0-9]{3})[–-]([0-9])([0-9])([0-9])"
    .MatchWildcards = True
    .ClearFormatting
    .Forward = True
    .Replacement.Text = ""
    .Wrap = wdFindStop
    Do
    .Execute
    If Not .Found Then
    Exit Do
    End If
    If .Found And selection.Range.Characters(2) = selection.Range.Characters(6) Then
    .Replacement.Text = " \1–\3\4"
    .Execute Replace:=wdReplaceOne
    If selection.Range.Characters(6).Text = "0" Then
    selection.Range.Characters(6).Delete
    End If

    End If
    Loop
End With




End Sub
Sub siweishu()
With selection.Find
    .Text = " ([0-9]{4})[–-]([0-9])([0-9])([0-9]{2})"
    .MatchWildcards = True
    .ClearFormatting
    .Forward = True
    .Replacement.Text = ""
    
    .Wrap = wdFindStop
    Do
    .Execute
    If Not .Found Then
    Exit Do
    End If
    If .Found And selection.Range.Characters(2) = selection.Range.Characters(7) Then
        If selection.Range.Characters(3) = selection.Range.Characters(8) Then
            .Replacement.Text = " \1–\4"
            .Execute Replace:=wdReplaceOne
            If selection.Range.Characters(7).Text = "0" Then
            selection.Range.Characters(7).Delete
            End If
        Else
            .Replacement.Text = " \1–\3\4"
            .Execute Replace:=wdReplaceOne
     

        End If
    
    End If
    selection.collapse wdCollapseEnd
    Loop
End With
End Sub

Sub wuweishu()
selection.HomeKey wdStory
With selection.Find
    .Text = " ([0-9]{5})[–-]([0-9])([0-9])([0-9])([0-9]{2})"
    .MatchWildcards = True
    .ClearFormatting
    .Forward = True
    .Replacement.Text = ""
    
    .Wrap = wdFindStop
    Do
    .Execute
    If Not .Found Then
    Exit Do
    End If
    If .Found And selection.Range.Characters(2) = selection.Range.Characters(8) Then
    
        If selection.Range.Characters(3) = selection.Range.Characters(9) Then
        
            If selection.Range.Characters(4) = selection.Range.Characters(10) Then
                .Replacement.Text = " \1–\5"
                .Execute Replace:=wdReplaceOne
                    If selection.Range.Characters(8) = 0 Then
                        selection.Range.Characters(8).Delete
                    End If
            Else
            .Replacement.Text = "\1–\4\5"
            .Execute Replace:=wdReplaceOne
            End If
        Else
        .Replacement.Text = "\1–\3\4\5"
        .Execute Replace:=wdReplaceOne
        End If
    
    
    End If
    

    
    Loop
End With
End Sub

以上是关于text 删除页码的主要内容,如果未能解决你的问题,请参考以下文章

在QPrintPreviewWidget中更改或删除页码

text 补全页码-8-13

word中插入页码最后一页不显示页码怎样设置?

页码制作

xsl-fo 删除第一页的页码

Word 页码设置教程:如何删除封面和目录的目录?