Temporarily hide dashed-underline without refreshing citations? (Word macro, etc.?)
I have a very large document that takes an extremely long time to refresh the citations and generate the bibliography. I have automatic updates disabled, of course.
Purely for aesthetic reasons while generating a draft to send to someone for feedback, I would like to remove the underlines in all citation fields, before saving as a PDF.
Is there any way to do that, without waiting for the long delay (this document takes over an hour now) for refreshing? (Note that I don't need the bibliography to appear in these drafts.)
Maybe a Word macro could do this?
I don't want to just select all then cmd+U, because that would also remove any other underline formatting throughout my document. Maybe just remove it from all fields only?
Purely for aesthetic reasons while generating a draft to send to someone for feedback, I would like to remove the underlines in all citation fields, before saving as a PDF.
Is there any way to do that, without waiting for the long delay (this document takes over an hour now) for refreshing? (Note that I don't need the bibliography to appear in these drafts.)
Maybe a Word macro could do this?
I don't want to just select all then cmd+U, because that would also remove any other underline formatting throughout my document. Maybe just remove it from all fields only?
Now the following seems to work to remove all underlines from Zotero fields.
Function ZoterZeroUnderFix(F) ' Fix a field to remove the automatic dashed underline if Zotero automatic updates is disabled
''does not update bibliography or correctly disambiguate citations, just convenient to export a draft for review rather than waiting for full update
If InStr(F.Code.Text, " ADDIN ZOTERO_ITEM CSL_CITATION") = 1 Then ' make sure this is a Zotero field to modify, starts with right text
F.Result.Font.Underline = wdUnderlineNone ' remove dashed underlining from Zotero's delayed update feature if present
End If
End Function
Sub ZoterZeroUnder()
'
' ZoterZero extention: remove dashed underlines from all Zotero fields in document
''let's update all fields in document
''' based on http://www.vbaexpress.com/kb/getarticle.php?kb_id=1100
Dim rngStory As Word.Range ' vars for below
Dim lngValidate As Long ' vars for below
Dim oShp As Shape ' vars for below
lngValidate = ActiveDocument.Sections(1).Headers(1).Range.StoryType ' starting point
For Each rngStory In ActiveDocument.StoryRanges 'Iterate through all linked stories
Do
On Error Resume Next
checkField = rngStory.Fields.Count ' get the total number of fields in this section
While checkField > 0 ' check each field
changeSuccess = ZoterZeroUnderFix(rngStory.Fields(checkField)) ' check and fix this field
checkField = checkField - 1 ' check the previous field next
Wend
Select Case rngStory.StoryType
Case 6, 7, 8, 9, 10, 11
If rngStory.ShapeRange.Count > 0 Then
For Each oShp In rngStory.ShapeRange
If oShp.TextFrame.HasText Then
checkField = Shp.TextFrame.TextRange.Fields.Count ' get the total number of fields in this section
While checkField > 0 ' check each field
changeSuccess = ZoterZeroUnderFix(Shp.TextFrame.TextRange.Fields(checkField)) ' check and fix this field
checkField = checkField - 1 ' check the previous field next
Wend
End If
Next
End If
Case Else 'Do Nothing
End Select
On Error GoTo 0
'Get next linked story (if any)
Set rngStory = rngStory.NextStoryRange ' get ready for next section
Loop Until rngStory Is Nothing ' keep going through until all sections are done
Next
End Sub
I've tested it and it seems to work in Word on my Mac. I don't know whether it would always work for everyone, so no guarantees. Aside from the big looping action, all it does is checks each field to see if it's a Zotero field and if so it sets that field to not be underlined. To use: run the main ZoterZeroUnder() macro and it will automatically change all fields in the document.
Obvious warning: this is only for preview purposes and probably should only be used on copies of your document you're exporting as a preview.
--
This could also be useful, with minor changes, in the case that a user wants to make all citations bold, or something else along those lines.
Obviously only makes sense if your footnotes do not contain underlining for highlighting purposes.
Is that too easy? Am I overlooking anything?