Hi there,
I try to build a solution in C# that change and create BuiltInDocumentProperties and CustomDocumentProperties of Word Documents (doc and docx). I test with NetOffice but my changes will not save in the Document. Can anybody help to solve my problem?
I test it like this:
I try to build a solution in C# that change and create BuiltInDocumentProperties and CustomDocumentProperties of Word Documents (doc and docx). I test with NetOffice but my changes will not save in the Document. Can anybody help to solve my problem?
I test it like this:
try
{
app = new Word.Application();
Word.Document doc = app.Documents.Open(@"test.doc");
((NetOffice.OfficeApi.DocumentProperties)doc.CustomDocumentProperties)["Test"].Value = DateTime.Now.ToLongTimeString();
((NetOffice.OfficeApi.DocumentProperties)doc.CustomDocumentProperties).Add("NewProp", false, NetOffice.OfficeApi.Enums.MsoDocProperties.msoPropertyTypeString, DateTime.Now.ToLongTimeString());
doc.Save();
catch { }
finally
{
app.Quit();
app.Dispose();
}