tags:

views:

10

answers:

2

Hello,

Our application generates a Word document using Syncfusion's DocIO libs. Basically, we load a template and insert into it specific texts in specific bookmarks, generating a Word document that the user downloads on-the-fly.

The issue we are facing is:

  • The template is 4 pages long and has TOC.
  • As we add content, the document size in pages increases (naturally)
  • When the document is downloaded, the TOC still reflects the page numbers used in the template. In other words, the user must manually update the TOC (secondary click -> update field) in order to refresh the page numbers.

According Syncfusion's documentation (which is scarce...) this is not possible using their lib. So, we implemented an AutoOpen macro in the template that updates the TOC when the doc is opened as a workaround. However, this causes a security warning when opening the file (because of the macro), which makes our uses uncomfortable.

Does any of you have an idea to improve this implementation? Thanks,

A: 

Try this

Document wordDocument; Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application(); wordDocument = word.Documents.Open(saveFileDialog.FileName); wordDocument.TablesOfContents[1].Update(); wordDocument.Save(); word.Quit();

Darren Woodhouse
A: 

@Darren Woodhouse

hi,

in witch libary are this classes?

regards ladida

ladida