一、使用插件——论文抽屉
官网:毕业论文模板|学位论文模板|论文模板|图加软件「论文抽屉」-主页 (tujiastudio.com)
- 优点:国产,对于域的操作很方便;
- 缺点:需要付费使用;
二、编辑域——使用 宏
原理见:编号格式“图一.1”改为“图1.1”编号以阿拉伯数字显示 - 懵懂的菜鸟 - 博客园 (cnblogs.com)
这里只是将上述原理使用 宏 实现自动操作,先上代码:
Sub 题注正则替换()
'
' 题注正则替换 宏
'
'
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="SEQ seq \h"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^d SEQ seq \c"
.Replacement.Text = "SEQ seq \c"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "SEQ seq \c-"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "STYLEREF 1 \s"
.Replacement.Text = "SEQ seq \c"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.WholeStory
Selection.Fields.Update
End Sub
Sub 题注正则替换【更新】()
'
' 题注正则替换【更新】 宏
'
'
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="SEQ seq \h"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^d SEQ seq \c"
.Replacement.Text = "SEQ seq \c"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "SEQ seq \c-"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "STYLEREF 1 \s"
.Replacement.Text = "SEQ seq \c"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.WholeStory
Selection.Fields.Update
End Sub
食用方法:
1. 创建宏,将上述代码分别创建宏;
2. 将光标移至一级标题末尾,运行“题注正则替换”;
→结果:
3. 插入新图片后,将光标移至一级标题末尾,运行“题注正则替换【更新】”;
→结果: