新浪博客

#word#快速插入图表题注(去空格)以及交叉引用

2018-05-03 16:46阅读:
写论文技巧之图表的交叉引用这个我想大家已经很熟悉了,但是由于office源于国外,所以插入题注时图表与数字标签间默认会有一个空格:“图 3.1” ,我们希望得到“图3.1 ”这样的格式。因为如果是前者,交叉引用时在正文中就也有空格,会很难看~_~。
因此,我们采用宏的方式,插入题注的同时,删除该空格并设置题注格式。随意录制一个宏,将以下代码插入:
-----------------------------------------------------------------------------------
Sub 插入图()
CaptionLabels.Add Name:='表'
CaptionLabels.Add Name:='图'
With CaptionLabels('表')
.NumberStyle = wdCaptionNumberStyleArabic
.IncludeChapterNumber = True
.ChapterStyleLevel = 2
.Separator = wdSeparatorPeriod
End With
With CaptionLabels('图')
.NumberStyle = wdCaptionNumberStyleArabic
.IncludeChapterNumber = True
.ChapterStyleLevel = 2
.Separator = wdSeparatorPer
iod
End With
Selection.HomeKey Unit:=wdLine
Selection.InsertCaption Label:='图', TitleAutoText:='InsertCaption2', Title _
:='', Position:=wdCaptionPositionBelow, ExcludeLabel:=0
Selection.Style = ActiveDocument.Styles('图号')
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
End Sub
-----------------------------------------------------------------------------------
类似的将上述 Selection.InsertCaption Label:='图'改为“表”即可插入表。可以修改上述相关参数满足具体的编号需求。
在正文中引用该题注编号则直接用交叉引用即可。
最后是将这3个命令添加到 快速访问工具栏上,设置图表号和交叉引用变得很方便快捷。

我的更多文章

下载客户端阅读体验更佳

APP专享