List all fonts used in a document and easily replace fonts in Word
Sometimes you will encounter a Word document that contains fonts that you don’t want to be included. This may cause problems with inflating the file size due to embedding unnecessary fonts, legal concerns if the font isn’t allowed to be shared, or even layout issues if the font isn’t available to others and is being substituted. This post shows you how to see a list of all the fonts used in your Word documents and also how to quickly replace them.
How to see all fonts used in a Word document
Microsoft Word maintains a list of all the fonts used in the document in a handy XML file inside itself called the fontTable. It’s also possible to use a small snippet of Visual Basic for Applications (VBA) code to retreive and display a list of the used fonts. We show you how both options work below - choose the one that you are most comfortable with.
Option 1
Open the DOCX with 7-Zip and view the font table
If you don’t already have 7-Zip installed, or you can’t use it, please follow these instructions for looking inside Office files first.
Then, right-click on your chosen Word document and select the 7-Zip > Open archive option.
This will show you an Explorer-like view similar to the example below. Double click the /word/ folder to look inside.
You are looking for the file called fontTable.xml and you need to double click on this to open it.
You should then be seeing a page of XML similar to the one below. The fonts may well be expanded, in which case you can simply click on the minus symbols to the left of them to contract them all so they look like the ones below. This XML file includes a complete list of all of the fonts used in the Word document.
In the above example you can see the following fonts are being used:
Calibri
Yu Mincho
Arial
Times New Roman
MetaOT-Black
Neo Sans Pro Light
Yu Gothic Light
Calibri Light
Option 2: Use VBA
Visual Basic for Applications in Word enables you to create a Macro that will automatically search your open Word document and identify all the fonts being used. You don’t have to write the code, you can just paste in the example we’ve provided below. To get started you need to follow these instructions from Microsoft to enable the Developer tab in your Ribbon.
Once you have enabled it, select the Developer tab and then click the Visual Basic button (Alt+F11).
The Microsoft Visual Basic for Applications window will open - like below. Right-click on Normal in the list on the lefthand side and choose Insert > Module.
Expand the VBA code block below - then select and copy the code (Ctrl+C).
-
Option Explicit
Public Sub Main()
Dim sMsg As String
sMsg = GetFonts(ActiveDocument)
MsgBox "The fonts in this document are:" & vbNewLine & vbNewLine & sMsgIf Not CompareFonts(sMsg) = vbNullString ThenMsgBox "The following fonts are used in this document," & _
vbNewLine & "but are not installed on this PC:" & vbNewLine & CompareFonts(sMsg)
End IfEnd Sub
Private Function GetFonts(ByVal oDocument As Document) As String
Dim oParagraph As Paragraph
Dim i As Integer
Dim oWord As Words
Dim sFontType As String
Dim sMsg As StringFor Each oParagraph In oDocument.Paragraphs
For i = 1 To oParagraph.Range.Characters.Count
sFontType = oParagraph.Range.Characters(i).Font.Name
If InStr(1, sMsg, sFontType) = 0 Then
sMsg = sMsg & sFontType & vbNewLine
End If
Next
NextGetFonts = sMsg
End Function
Private Function CompareFonts(ByVal oFonts As String) As String
Dim vFont As Variant
Dim sMsg As String
Dim xFont As Variant
Dim i As Long
Dim allFonts As StringFor Each vFont In FontNames
allFonts = allFonts & vbNewLine & vFont
Next vFontxFont = Split(oFonts, vbNewLine)
For i = 0 To UBound(xFont)
If InStr(allFonts, xFont(i)) = 0 Then
sMsg = sMsg & vbNewLine & xFont(i)
End If
Next iCompareFonts = sMsg
End Function
Click into the blank VBA window below the word (General) and paste the code (Ctrl+V). It should look like the picture below. Click Save and then close the window to return to Word.
Click the Macros button (or Alt+F8) on the Developer ribbon.
Find and select the Macro you have just created, which should be called Module1.Main. Then press the Run button.
A messagebox will appear with a list of all the fonts used in the current Word document. If you saved this in Normal then it will be available to other documents created using the normal template.
How to find and replace fonts in Word
Once you have a list of the fonts used in your document, if there are any fonts included that you want to remove, then you can use these instructions to quickly find and replace all instances of the font in your whole document. To do this we are going to use the Advanced Find feature in Word.
On the Home tab, near the righthand side you will find the Editing button — drop this down and click on the down arrow next to the Find option, then select Advanced Find… as shown below.
Select the Replace tab on the Find and Replace dialog that appears. Then click the More >> button.
Click in the Find what: box near the top.
Then click the Format button near the bottom and choose Font…
Choose the font that you want to replace in the Font: dropdown indicated below and click OK.
Next click in the Replace with: box and click Format > Font… again to select the font that you want to replace with.
Finally click the Replace All button indicated above. Word will search through and find any text set to use MetaOT-Black and change them to use Calibri instead. After it has finished it will display a message box, letting you know how many font replacements were made.
Should we make a Word Add-in for this?
Please can you let us know if you’d be interested in a Word add-in that made viewing a list of fonts in Word and replacing them super easy. We have already built something similar for PowerPoint called Slidewise, and we’d love to know if a similar tool for Word would be useful.
It might look something like this — as you can see it would also show you the size of images and other resources in your document.
Register interest
If you’d be excited to add Wordwise to your toolbox - please can you share your email with us to let us know. If you do we’ll also keep you notified of any progress.