I want to use the OpenXML library to update the value of a custom document property.
I can read and see the custom properties, and maybe even update the value of one of them, but can't quite see how to get it to save back.
using (var xl = SpreadsheetDocument.Open(filePath, true)) { Console.WriteLine(xl.CustomFilePropertiesPart.Properties.OuterXml); var property = xl.CustomFilePropertiesPart.Properties.GetFirstChild<Property>(); Console.WriteLine("Property {0} = {1}", property.Name, property.VTLPWSTR.Text); property.VTLPWSTR.Text = "Updated " + DateTime.Now.ToString(); xl.Close(); }
The intellisense for the Close method says it saves and closes the document and all parts, but the file is not updated. What am I missing here?