{"id":497,"date":"2020-03-16T10:46:05","date_gmt":"2020-03-16T00:46:05","guid":{"rendered":"https:\/\/www.docx4java.org\/blog\/?p=497"},"modified":"2020-03-16T10:46:05","modified_gmt":"2020-03-16T00:46:05","slug":"documents4j-for-toc-update","status":"publish","type":"post","link":"https:\/\/www.docx4java.org\/blog\/2020\/03\/documents4j-for-toc-update\/","title":{"rendered":"documents4j for TOC update"},"content":{"rendered":"<p>documents4j can also be used to update the TOC page numbers in your docx file.<\/p>\n<p>For this, there are 2 adjustments to our previous post.<\/p>\n<p>The first is that you convert to(target).as(DocumentType.DOCX), not DocumentType.PDF, so you get docx output.<\/p>\n<p>The second is that you need a customised word_convert.vbs containing, for example:<\/p>\n<pre>\r\n    ' Update TOC\r\n    wordDocument.TablesOfContents(1).UpdatePageNumbers\r\n<\/pre>\n<p>This code will update the first TablesOfContents.   <\/p>\n<p>See further https:\/\/github.com\/documents4j\/documents4j\/blob\/master\/documents4j-transformer-msoffice\/documents4j-transformer-msoffice-word\/src\/main\/resources\/word_convert.vbs<\/p>\n<p>word_convert.vbs is typically found in your documents4j-transformer-msoffice-word.jar <\/p>\n","protected":false},"excerpt":{"rendered":"<p>documents4j can also be used to update the TOC page numbers in your docx file. For this, there are 2 adjustments to our previous post. The first is that you convert to(target).as(DocumentType.DOCX), not DocumentType.PDF, so you get docx output. The second is that you need a customised word_convert.vbs containing, for example: &#8216; Update TOC wordDocument.TablesOfContents(1).UpdatePageNumbers [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-497","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts\/497","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/comments?post=497"}],"version-history":[{"count":1,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts\/497\/revisions"}],"predecessor-version":[{"id":498,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts\/497\/revisions\/498"}],"wp:attachment":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/media?parent=497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/categories?post=497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/tags?post=497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}