1

How to update table of contents (TOC) and then convert docx file to pdf? I want to create and update table of content in docx file and then convert it to pdf, so I want this TOC to be updated in pdf file.

This code update TOC after opening docx file by user and I don't need it.

docx.enforceUpdateFields();

I want TOC to be updated automatically by my program. Thanks.

Atefeh Rashidi
  • 485
  • 1
  • 8
  • 32

1 Answers1

2

Based on comment in this link, I found out that there is no way to update TOC automatically. Ben said on that comment "It then relies on a user to open the document in Word to generate the actual table of contents. Unfortunately, Word can't be made to update the TOC automatically and without user interaction".

Atefeh Rashidi
  • 485
  • 1
  • 8
  • 32