我有一个带很多脚注的文档,但现在我必须将这些参考文献转换为哈佛参考系统。
例子:
Lorem ipsum dolor sit amet, consectetur adipiscing elit 1。 Sed ac purus a sem sagittis dignissim。
...
1 Curabitur 和 sapien feugiat
进入:
Lorem ipsum dolor sit amet,consectetur adipiscing elit [Curabitur at sapien feugiat]。 Sed ac purus a sem sagittis dignissim。
谁能帮我这个?
编辑:
我有 Office 2007 和 2013。
答案1
这宏完全可以满足您的需求。以下是使用方法(底部有屏幕截图)
注意:此宏会在每次脚注移动结束时禁用撤消,因此在执行任何操作之前请保留文档的备份,以防它不能完全按照您的要求执行!!您可以通过删除倒数第三行和倒数第四行来重新启用撤消,但如果您的文档非常大,我不建议这样做!!
要在 Office 2013 中进行设置(来自与上面相同的链接,我已针对 Office 2013 对其进行了编辑):
1)按Alt+F11
2)在菜单栏顶部,单击“插入”>“模块”
3)在主窗口中复制并粘贴以下宏
4)在属性窗口中,将模块重命名为您想要的任何名称,如果更改模块名称,则重命名为左侧窗口中的名称。
5)保存正常并关闭编辑器
6)按 Alt+F8,选择宏,然后按运行
宏(我已对其进行了编辑,因此其工作方式与示例中相同)。您可以将颜色代码更改为任何您想要的颜色 - 您希望颜色的十进制值- 默认为黑色:
Sub foot2inline()
Dim oFeets As Footnotes
Dim oFoot As Footnote
Dim oRange As Range
Dim szFootNoteText As String
' Grabs the collection of FootNotes
Set oFeets = Word.ActiveDocument.Footnotes
' Iterates through each footnote
For Each oFoot In oFeets
szFootNoteText = oFoot.Range.Text
'Start search from beginning of document
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^f" ' Looks for all footnotes
.Forward = True
.Wrap = wdFindStop
End With
Selection.Find.Execute
' Delete the footnote
oFoot.Delete
'Insert the footnote text
'Here you do whatever format tickles your fancy
'The only thing you need to keep is the speech marks and 'szFootNotetext'
'Make sure anything you want to surround the citations is inside speech marks.
'For example = " (" + szFootNoteText + ") "
Selection.Text = " [" + szFootNoteText + "] "
'CHANGE COLOR HERE. Color code is below.
Selection.Font.Color = 0
'Disables undo to save memory on very large documents.
ActiveDocument.UndoClear
Next
End Sub
截图:
设置宏: 带有脚注的文档: 使用宏: 带有参考系统的文档:
答案2
它非常有效。
我稍微修改了你的宏,这样就可以将脚注的内容添加到参考书目来源中(作为标题),并在脚注引用的位置插入引文。
也许有人会用这个:
Sub foot2inline()
Dim oFeets As Footnotes
Dim oFoot As Footnote
Dim oRange As Range
Dim szFootNoteText As String
' Grabs the collection of FootNotes
Set oFeets = Word.ActiveDocument.Footnotes
Dim tagNumber As Integer
tagNumber = 1
' Iterates through each footnote
For Each oFoot In oFeets
szFootNoteText = oFoot.Range.Text
'Start search from beginning of document
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^f" ' Looks for all footnotes
.Forward = True
.Wrap = wdFindStop
End With
Selection.Find.Execute
' Delete the footnote
oFoot.Delete
'Insert the footnote text
'Here you do whatever format tickles your fancy
'The only thing you need to keep is the speech marks and 'szFootNotetext'
'Make sure anything you want to surround the citations is inside speech marks.
'For example = " (" + szFootNoteText + ") "
Dim tag As String
tag = "Tag" + CStr(tagNumber)
Selection.Fields.Add Selection.Range, _
wdFieldCitation, tag
Dim strXml As String
strXml = _
"<b:Source xmlns:b=""http://schemas.microsoft.com/" & _
"office/word/2004/10/bibliography""><b:Tag>" & tag & "</b:Tag>" & _
"<b:SourceType>Book</b:SourceType><b:Author><b:Author>" & _
"<b:NameList><b:Person><b:Last>LastName</b:Last>" & _
"<b:First>FirstName</b:First></b:Person></b:NameList></b:Author>" & _
"</b:Author><b:Title>" & szFootNoteText & "</b:Title>" & _
"<b:Year>1996</b:Year><b:City>City</b:City>" & _
"<b:Publisher>Publisher</b:Publisher>" & _
"</b:Source>"
ActiveDocument.Bibliography.Sources.Add (strXml)
'CHANGE COLOR HERE. Color code is below.
Selection.Font.Color = 0
'Disables undo to save memory on very large documents.
ActiveDocument.UndoClear
tagNumber = tagNumber + 1
Next
End Sub