Create a custom office document property that is linked to content inside a powerpoint document RRS feed

  • Question


    I want to create a custom document property in powerpoint that is linked to the document content in C#.

    I found various examples, but they all create custom document properties WITHOUT linking to document content.

    What I want to achieve is that a user selects text in any shape and by clicking a button, the custom document property is created together with a link to the source.
    I want to be able to retrieve it later and on demand jump to the linked content.

    Here is the code snippet that I'm using:

    Microsoft.Office.Core.DocumentProperties properties;   properties = (Office.DocumentProperties)this.myOCMModule.PowerPointApp.ActivePresentation.CustomDocumentProperties;   

    Microsoft.Office.Interop.PowerPoint.Selection powerPointSelection  = this.myMainOCMModule.PowerPointApp.ActiveWindow.Selection;   

    PowerPoint.TextRange textRange = powerPointSelection.TextRange;   

    properties.Add("Test1", true, Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString, textRange.Text, textRange);

    The custom property is created but the link is not valid. When I open the custom properties in PowerPoint, it the custom property appears with a broken link.

    When i do it manually by creating a custom property it works when doing it like described [here][1].

    I want to do the same thing programmatically.

    In the MS reference it states

    > The source of the specified link is defined by the container application.

    Maybe it can't resolve the textRange variable properly?

    Does anyone know how i can make this work?


    Thanks in advance,


    Thursday, September 5, 2013 8:05 PM