Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

New Post: Change and create documentProperties

$
0
0
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:
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();
}

Viewing all articles
Browse latest Browse all 1741

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>