Programmatically adding section titles in the header of a MS Word document
<p>I am looking for a way to programmatically add the title of the current section into the header of each page in a word document. I have found <a href="https://msdn.microsoft.com/en-us/library/ms178795.aspx" rel="nofollow">this page</a> that explains how to access and modify the header. My understanding after reading this link is that to have something different on each page you need to add the right field. Now I have been looking for this field without success. <a href="https://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.wdfieldtype.aspx" rel="nofollow">This other page</a> gives a list of fields, and <code>wdFieldSection</code> looked very promising but it didn't work in my document (it adds "1" on each page).</p>