Skip to content

Instantly share code, notes, and snippets.

@rwuwon
Last active April 19, 2025 15:49
Show Gist options
  • Select an option

  • Save rwuwon/2d490d3ea5b65224dc0c2a4f5f1e8b4e to your computer and use it in GitHub Desktop.

Select an option

Save rwuwon/2d490d3ea5b65224dc0c2a4f5f1e8b4e to your computer and use it in GitHub Desktop.
Microsoft 365 / Office 365 Table of Contents page number bug: Possible Workaround

Microsoft 365 / Office 365 Table of Contents page number workaround

EDIT: Actually you know what - there's no point fighting MS365. You'll save far more time if you just update the index in LibreOffice, Google Docs, or offline Word and then re-upload and check. It should also be noted that the Table of Contents will display differently when you view the doc online vs offline. So it could well be that you can ignore how the online version appears since that one will never reflect reality. Additionally, MS365 works better in Chrome/Edge than Firefox.

The following steps still don't work under certain conditions, but are a tantalising step closer as far as much simpler documents go. It's remarkable how easy it is to reproduce this bug though.

┬──┬╯︵ /(.□. \) (╯°□°)╯︵ ┻━┻

Microsoft 365 has a longstanding bug where the automatic Table of Contents fails to show the correct page numbers. There are countless threads with vague steps on how to sort it out, as well as steps that are not quite complete. There's even an "update it in Google Docs and re-upload to MS365" workaround which might well work and could be worth trying if the following steps fail. Anyway, good luck and I hope the following gets you closer to figuring out what's going on and why it updates so irrationally:

  1. BACKUP multiple copies

  2. Practise on copies of your current document. Make several copies in a separate location because you'll want to practise this. Don't forget to have a real backup of your current work elsewhere too (both in the cloud and offline).

  3. Turn the Navigation pane on, and also non-printing characters (Ctrl+Shift+8)

  4. For every single header in the navigation pane (both Heading 1 and Heading 2), insert a line break both before and after the header.

  5. Click and scroll around a bit on each page for it to update to the new state or the table of contents might not pick it up. Also check that you don't have spaces on the same line before or after your headers as this might throw it all off too. ¯\_(ツ)_/¯

  6. Go back up to the table of contents, right click and update and the page numbers should reflect a lot more accurately. If you see a change but it's not quite there, re-examine step 3. An interesting intermediate bug is that nearly every page might end up being something like Page 2 or 3. This is actually a good response because it shows you're close to the "fix". So retry steps 3 and 4 and check you didn't skip a header.

  7. Remove the extra line breaks but don't update the table of contents again.

  8. If this is all too confusing, start with a brand new blank doc and experiment with the simplest of Heading 1 + Page Break (Ctrl-Enter) combinations. It's ridiculously buggy.

┬──┬╯︵ /(.□. \) (╯°□°)╯︵ ┻━┻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment