none
Change Property of a word document Programmatically RRS feed

  • Question

  • I have created a word vsto Add-ins where I open my document/templates from a server.

    I wish to customise the property/doctype for example the Title/Author programmatically using C#!
    I have gone through many examples, but not seem to work. Can anyone please help me with this?

    Thanks

    Kind Regards

    ASK

    Wednesday, July 11, 2018 7:49 AM

Answers

  • Hello ASK,

    Please try to use Document.BuiltInDocumentProperties to change these built-in properties.

    For example.

      Word.Document document = Globals.ThisAddIn.Application.ActiveDocument;
                document.BuiltInDocumentProperties["Author"] = "My Cusotmer Author";
                document.BuiltInDocumentProperties["Title"] = "My Cusotm Title";

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by ask98 Monday, July 16, 2018 4:53 AM
    Friday, July 13, 2018 7:29 AM

All replies

  • Hi ask98,

    Thank you for posting here.

    Since your question is more related to word, I will move it to Word for Development forum for suitable support.

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=worddev&filter=alltypes&sort=lastpostdesc

    The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, July 13, 2018 5:57 AM
  • Hello ASK,

    Please try to use Document.BuiltInDocumentProperties to change these built-in properties.

    For example.

      Word.Document document = Globals.ThisAddIn.Application.ActiveDocument;
                document.BuiltInDocumentProperties["Author"] = "My Cusotmer Author";
                document.BuiltInDocumentProperties["Title"] = "My Cusotm Title";

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by ask98 Monday, July 16, 2018 4:53 AM
    Friday, July 13, 2018 7:29 AM
  • Hi Terry,

    Thank you, this works perferctly. 

    Kind Regards

    ASK

    Monday, July 16, 2018 4:54 AM
  • Hello Wendy,

    Thanks

    Regards

    ASK

    Monday, July 16, 2018 4:54 AM