Custom properties

Basic usage with a single shape

var page = doc.Pages.Add();
var s1 = page.DrawRectangle(0, 0, 1, 1);
var cp = new VisioAutomation.Shapes.CustomPropertyCells();
cp.Value = "Hello World";
VisioAutomation.Shapes.CustomPropertyHelper.Set(s1, "Propname", cp);

// Retrieve all the Custom properties from a shape
var props = VisioAutomation.Shapes.CustomPropertyHelper.Get(s1);

// Delete the property from the shape
VisioAutomation.Shapes.CustomProperties.CustomPropertyHelper.Delete(s1, "Propname");

NOTES:

  • CustomPropertyHelper.Get returns a dictionary. The keys of the dictionary are the custom property names, the values are CustomPropertyCells objects.

  • The CustomPropertyCells Object holds the values for the custom properties:

    • Calendar

    • Format

    • Invisible

    • Label

    • LangID

    • Prompt

    • SortKey

    • Type

    • Value

    • Verify

Work with multiple shapes

Count properties and find names

Last updated

Was this helpful?