Inserting custom properties in a table in a header in a different section

Jan 9, 2012 at 2:52 PM

Following on from this discussion (document contained in issue)

The table I want to update is in the header of the section 2 and has the placeholders…

@SSFor@, @SSDate@, @SSSurveyors@, @SSNotes@

MadBoy has advised using custom properties. I wanted to update an existing property - something like…

document.CustomProperties["CustomProp1"].Value = “For the Government.”;

However, it seems custom properties are read only, so I need to locate the table and then add the custom property at the correct cell. My problem is I can’t seem to find the table in the document, it’s not in the Document.Table or the Header.Table collection.

I‘ve checked the actual xml of the docx and it’s there, I just can’t seem to find it in the DocX object model.


Jan 9, 2012 at 3:20 PM

Ok, thanks to this post

I understand how to update a custom property - seems you have to add it again, which is a little odd.

Then a manual print preview to update all the fields and all is good.


Thanks to MadBoy for pointing me in the right direction.



Jan 9, 2012 at 3:30 PM

If you update to newest Source Code (not just the binary), and visit this and use the code from like last few posts and compile it yourself the custom property should be updated automatically (the last manual step isn't nessecary). This should soon be incorporated by Nordes but you may want to do it yourself before he does ( i think he plans it for tommorow).