using (_objDoc = WordprocessingDocument.Open(szFileName, true)) { DocumentSettingsPart settingsPart = _objDoc.MainDocumentPart.GetPartsOfType<DocumentSettingsPart>().First(); UpdateFieldsOnOpen updateFields = new UpdateFieldsOnOpen(); updateFields.Val = new DocumentFormat.OpenXml.OnOffValue(true); settingsPart.Settings.PrependChild<UpdateFieldsOnOpen>(updateFields); settingsPart.Settings.Save(); }
With Options .UpdateFieldsAtPrint = True .UpdateLinksAtPrint = True End With For Each l_section In ActiveDocument.Sections For Each l_headerfooter In l_section.Headers l_headerfooter.Range.Fields.Update Next l_headerfooter For Each l_headerfooter In l_section.Footers l_headerfooter.Range.Fields.Update Next l_headerfooter Next l_section ActiveDocument.Fields.Update
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)