Jump to content
misc_bb

Updating Table of Contents in docx with OOXML

Recommended Posts

Working with OOXML in Delphi is.. interesting :classic_biggrin: Now I can generate docx files by manipulating XML tags, although working with a library makes things easier. Now another hiccup is updating the table of contents. The only solution for now I have for now is the option where the user is prompted with a message box every time the Word document opens asking this screen below. I want to get rid of it or avoid this from showing up. 

image.thumb.jpeg.edb6f432de635351fc4ecdd02899f5e9.jpeg

 

If user selects "Yes", the table of contents is updated. This is also based on Eric White's blog:

 

This option, is not always the best experience we want to our users. Has anyone encountered this before? Eric did mention Word automation using a macro and another is setting up word automatic services via a Sharepoint in the server, this is not going to be an option for now. So we want to automatically update TOC inside the docx file without prompting the user. If you have a suggestion, I would highly appreciate it.

 

Thanks!

 

Edited by misc_bb

Share this post


Link to post

I'd compare your original docx before and the one after the user pressed "Yes". Maybe you can see what you have to change in the differences.

Share this post


Link to post

Well, what I'm referring here is what other option I can do to update the table of contents. This pop up box will really display because I set 'w:updateFields' to true. This is basically part of the OOXML setup for Table of Contents. In LibreOffice/ODT file, what they normally do is open the file to perform the updating of the table of contents.

 

You know what, I think I just have an idea how to get around with this. :classic_biggrin:

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×