Created
September 2, 2018 17:42
-
-
Save zthxxx/8e0e7febd217bbf68d0e247d970ff863 to your computer and use it in GitHub Desktop.
word 论文中插入打断符,用于打断查重系统读取句子或词语的重复率判断
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub 插入打断符() | |
' | |
' 插入打断符 宏 | |
' 每间隔 ds 个字符插入一个打断符,用于打断查重系统读取句子或词语的重复率判断 | |
' 需要导入一个叫 “打断符” 的样式 | |
' 字体样式继承 正文 | |
' 字体后续样式 正文 | |
' 字体大小 1px | |
' 字体颜色 白色 | |
' 字体宽度 0% | |
' | |
Const ds As Integer = 4 | |
Const broke As String = "¥" | |
Dim selected As Range | |
Set selected = Selection.Range | |
'先判断是否有选中区域,没有选中则表示整个文档 | |
If selected.Start = selected.End Then | |
Exit Sub | |
End If | |
With selected.Find | |
.ClearFormatting | |
.MatchWildcards = True | |
.Text = "(?{" & ds & "})" | |
.Replacement.Text = "\1" & broke | |
.Replacement.ClearFormatting | |
.Execute Replace:=wdReplaceAll | |
End With | |
With selected.Find | |
.ClearFormatting | |
.MatchWildcards = False | |
.Text = broke | |
.Replacement.Text = broke | |
.Replacement.ClearFormatting | |
.Replacement.Style = ActiveDocument.Styles("打断符 字符") | |
.Execute Replace:=wdReplaceAll | |
End With | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment