Search code examples
c#-4.0ms-wordvstoword-automation

Document.BuiltInDocumentProperties makes the document dirty and prompts to save everytime


The Document.BuiltInDocumentProperties makes the document dirty and prompts to save everytime even nothing has changed.

I am trying to get the template of the document in the document change event

ActiveDocument.BuiltInDocumentProperties["Template"]

But ActiveDocument.CustomDocumentProperties works fine.


Solution

  • Template template = (Template)ActiveDocument.get_AttachedTemplate();
    

    This code also gets the template of the document and it doesn't makes the document dirty. But still curious to know why ActiveDocument.BuiltInDocumentProperties["Template"] makes document dirty.