Getting page numbers in .docx TOC

I’m compiling for .docx for the first time, and can’t figure out how to replace the page placeholders with page numbers. The manual and other sites suggest File > Print [Current Document?], then canceling, which doesn’t work for the ToC file. Compiling for Print produces page numbers, but I need .docx output, not PDF. Is there a solution that isn’t manually replacing every <$p>?

Open the output document in Word, which will replace the placeholders with real page numbers.

Well, that was easy - thanks for the lightning-fast reply! :smile: Now all I have to do is buy Word for Mac - I’ve been opening the .docx files in Pages. Thanks again!

1 Like

Installed Word, recompiled, opened in Word, and no page numbers. :frowning:

Did you try to print from Word?

Basically, you need to trigger something that will trigger Word’s repaginate mechanism.

That did it!! (Except for one bizarre misnumbering by Word.) Thanks again - you’re a lifesaver.

Further to @kewms, after almost 40 years, I no longer have or use Microsoft Word so I cannot check the menus/commands for you … but TOC numbers in Word are what they call fields. Fields store values of things.

There are many fields in Word and many are extremely useful for helping to automate use of Word. There is a button on the toolbar to facilitate entering them into your documents. Very useful things. Scrivener has same thing, but called “Placeholders”.

Fields in Word have to be “updated” to be up to date since the document changes (called, writing). A common way to update fields (including TOC fields) is to select the entire document, right-mouse click on the selected document, and pick “Update Fields” (or whatever words they use). For TOC fields often needed to do it twice as the mere fact of updating the fields changes how the document is spaced out and the TOC is out of date, so has to be done a second time against the new spacing.

There is an option somewhere in Word to “update fields before printing”. Either in Preferences or on the Print dialog box. I can’t remember. As long as that option is click “on” printing will update fields. That is why @kewms suggested you print.

What @rms said.

Now, if Pages is able to understand Word fields at all, it should be able to update them, but that’s a question for Apple. We only test our Word converter for true Microsoft Word compatibility.

1 Like

Yea, but I don’t think Apple will do it. Not out of spite or anything, but people who use Pages (like me as an occasional user, now that Word no longer installed), don’t long for that sort of capability. And it’s free of cost to Apple users, so no revenue for Apple.

You are wise to strive for full compatibility with Word and not Pages!

@rms and @kewms, I greatly appreciate these follow-ups. Thanks for the deep dive.