public static void Set_Custom_Property_on_multiple_Shapes(IVisio.Document doc)
        {
            // Set Custom Property_on_a_shape

            var page = doc.Pages.Add();
            var s1   = page.DrawRectangle(0, 0, 1, 1);
            var s2   = page.DrawRectangle(2, 2, 4, 4);

            var cp1 = new VisioAutomation.Shapes.CustomPropertyCells();

            cp1.Value = "Hello";
            VisioAutomation.Shapes.CustomPropertyHelper.Set(s1, "Propname", cp1);

            var cp2 = new VisioAutomation.Shapes.CustomPropertyCells();

            cp2.Value = "World";
            VisioAutomation.Shapes.CustomPropertyHelper.Set(s2, "Propname", cp2);

            // Retrieve all the Custom properties from multiple shapes

            var shapes = new[] { s1, s2 };
            var props  = VisioAutomation.Shapes.CustomPropertyHelper.GetCellsAsDictionary(page, shapes, CellValueType.Formula);


            // Delete the properties from the shapes
            VisioAutomation.Shapes.CustomPropertyHelper.Delete(s1, "Propname");
            VisioAutomation.Shapes.CustomPropertyHelper.Delete(s2, "Propname");

            //cleanup
            page.Delete(0);
        }
        public static void Counting_properties(IVisio.Document doc)
        {
            // Set Custom Property_on_a_shape

            var page = doc.Pages.Add();
            var s1   = page.DrawRectangle(0, 0, 1, 1);

            var cp1 = new VisioAutomation.Shapes.CustomPropertyCells();

            cp1.Value = "Hello";
            VisioAutomation.Shapes.CustomPropertyHelper.Set(s1, "Propname", cp1);

            int num_custom_props  = VisioAutomation.Shapes.CustomPropertyHelper.GetCount(s1);
            var custom_prop_names = VisioAutomation.Shapes.CustomPropertyHelper.GetNames(s1);

            //cleanup
            page.Delete(0);
        }
        public void Dom_CustomProperties()
        {
            // Create the doc
            var shape_nodes = new VADOM.ShapeList();
            var vrect1      = new VADOM.Rectangle(1, 1, 9, 9);

            vrect1.Text = new VisioAutomation.Models.Text.Element("HELLO WORLD");

            vrect1.CustomProperties = new VA.Shapes.CustomPropertyDictionary();

            var cp1 = new VA.Shapes.CustomPropertyCells();

            cp1.Value = "\"FOOVALUE\"";
            cp1.Label = "\"Foo Label\"";

            var cp2 = new VA.Shapes.CustomPropertyCells();

            cp2.Value = "\"BARVALUE\"";
            cp2.Label = "\"Bar Label\"";

            vrect1.CustomProperties["FOO"] = cp1;
            vrect1.CustomProperties["BAR"] = cp2;

            shape_nodes.Add(vrect1);

            // Render it
            var app = this.GetVisioApplication();
            var doc = this.GetNewDoc();

            shape_nodes.Render(app.ActivePage);

            // Verify
            Assert.IsNotNull(vrect1.VisioShape);
            Assert.AreEqual("HELLO WORLD", vrect1.VisioShape.Text);
            Assert.IsTrue(VA.Shapes.CustomPropertyHelper.Contains(vrect1.VisioShape, "FOO"));
            Assert.IsTrue(VA.Shapes.CustomPropertyHelper.Contains(vrect1.VisioShape, "BAR"));

            doc.Close(true);
        }
        public static void Set_Custom_Property_on_Shape(IVisio.Document doc)
        {
            // Set Custom Property_on_a_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.GetCells(s1, CellValueType.Formula);

            // Delete the property from the shape

            VisioAutomation.Shapes.CustomPropertyHelper.Delete(s1, "Propname");

            //cleanup
            page.Delete(0);
        }