Microsoft Word 365¶
Keyboard Shortcuts¶
Show/Hide all formatting marks: Ctrl + Shift + 8
Find/Replace non-breaking spaces: ^s
Find/Replace index entries (field codes) ^dxe
Crop PDF files¶
PDF Arranger (pdfarranger portable)
Open PDF file, select all, and hit "C", then enter crop margins:
L/R - 8%
Top - 9%
Bottom - 6%
Save styles to a template for sharing with others¶
Make sure the current doc has the styles you want, then go to the 'Design' tab and right click on "This Document's Style Set" (probably the first one in the list). Save as and note the folder where it wants to save
(%appdata%\Microsoft\QuickStyles)
Put it in that folder on the new user's computer and it should show up ready for use with 1 click!
Making non-problematic numbered listing styles in Word¶
- Create a new style based on Normal.
- Select "Numbering" in the Format options.
- Define New Number Format and format as desired (Right align, Verdana 11pt)
- Click OK to create the new style and apply it to some text.
- Right click in the text styled with our new style and select 'Adjust List Indents' to set the desired indention levels (Number position: .375") and then allow it to update the style so it applies to all future lists with that style.
Convert numbered lists to static numbers¶
(Or: Converting Automatic Numbering to Manual Numbering)
Paste the following into the Immediate Window:
Find:
(^13)([0-9]{1,})\.[^t ] <-- TAB or space
Replace: \1(\2)
Find wildcard/GREP¶
Find scripture refs that begin with a number and add a nbsp so that they don't break at the end of a line:
Find: ([1-3]) ([SKCTPJ][aihoe][mnreth])
Replace: \1^s\2
Find footnotes with wildcards¶
Find: (^2)
Replace: (\1)
Find: (^2)([.,?;:])
Replace: \2\1
Different dashes that Word uses¶
Convert "dirty" translation files to clean¶
First, some Word cleanup - Change disc bullets to triangles/little book symbols? - Check graphics
pandoc -s --extract-media=. "input.docx" -o clean.md --wrap=none
Then some post processing on the .md file:
\\\r\n > \r\n\r\n # Convert soft para breaks to hard
^\*\*\r\n > (nothing) # delete empty bold paras
^\*\xa0\*\r\n > (nothing) # delete italics+nbsp+para
^\*\*\xa0{1,}\*\*\r\n > (nothing) # delete bold+nbsp+para
^\xa0\r\n > (nothing) # delete nbsp+para
^\r\n\r\n > \r\n # delete extra paras (loop until they're all gone)
\*\xa0{2,}\* > (nothing) #
\xa0{3,} > (space) # more than 3 nbsps
^\h{1,} > (nothing) selectively # remove strings of spaces
^\((\d+)\) > \\\($1\\\) # fix nums in parenths (else they're converted to num lists in Word)
Post process .md files¶
Convert Word to Markdown
1. Open folder with files
2. Type Alt + fsa to open elevated PowerShell (necessary, cause I'm not an admin user)
3. Run the following to convert ALL *.docx files in the folder to .md (source)
gci -r -i *.docx |foreach{$md=$_.directoryname+"\"+$_.basename+".md";pandoc -f docx -s $_.name -o $md --wrap=none}
Convert Word to PLAIN text¶
old method¶
pandoc -s "Heading.docx" -o "Heading2.md" --wrap=none
pandoc -s --from docx "Spiritual Formation.docx" --to markdown_strict+footnotes -o "test-no-tables2.md" --wrap=none
pandoc -s -o "Spiritual Formation-CLEAN-Noto.docx" "Spiritual Formation-CLEAN.md" --reference-doc="C:\Users\User-E\AppData\Roaming\pandoc\custom-reference-old.docx"
Convert Word to ICML
Word macro to convert footnotes to inline parentheses¶
Sub foot2inline()
' Maybe use: Application.ScreenUpdating = False
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
Selection.Text = " (" + szFootNoteText + ")"
'CHANGE COLOR HERE. Color code is below.
' https://docs.microsoft.com/en-us/office/vba/api/Word.WdColor
Selection.Font.Color = 16737843
'Disables undo to save memory on very large documents.
ActiveDocument.UndoClear
Next
End Sub