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.CustomProperties.CustomPropertyCells();

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

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

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

            // Retrieve all the Custom properties from multiple shapes

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

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

            //cleanup
            page.Delete(0);
        }
示例#2
0
        public void DOM_CustomProperties()
        {
            // Create the doc
            var shape_nodes = new VA.DOM.ShapeList();
            var vrect1 = new VA.DOM.Rectangle(1, 1, 9, 9);
            vrect1.Text = new VA.Text.Markup.TextElement("HELLO WORLD");

            vrect1.CustomProperties = new Dictionary<string, VA.Shapes.CustomProperties.CustomPropertyCells>();

            var cp1 = new VA.Shapes.CustomProperties.CustomPropertyCells();
            cp1.Value = "FOOVALUE";
            cp1.Label = "Foo Label";

            var cp2 = new VA.Shapes.CustomProperties.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.CustomProperties.CustomPropertyHelper.Contains(vrect1.VisioShape, "FOO"));
            Assert.IsTrue(VA.Shapes.CustomProperties.CustomPropertyHelper.Contains(vrect1.VisioShape, "BAR"));

            doc.Close(true);
        }
示例#3
0
        private void SetFromParameters()
        {
            var cp = new VA.Shapes.CustomProperties.CustomPropertyCells();

            cp.Value = this.Value;

            if (this.Label != null)
            {
                cp.Label = this.Label;
            }

            if (this.Format != null)
            {
                cp.Format = this.Format;
            }

            if (this.Prompt != null)
            {
                cp.Prompt = this.Prompt;
            }

            if (this.LangId >= 0)
            {
                cp.LangId = this.LangId;
            }

            if (this.SortKey >= 0)
            {
                cp.SortKey = this.SortKey;
            }

            if (this.Type >= 0)
            {
                cp.Type = this.Type;
            }

            if (this.Ask >= 0)
            {
                cp.Ask = this.Ask;
            }

            if (this.Calendar >= 0)
            {
                cp.Calendar = this.Calendar;
            }

            if (this.Invisible >= 0)
            {
                cp.Invisible = this.Invisible;
            }

            this.client.CustomProp.Set(this.Shapes, this.Name, cp);
        }
示例#4
0
 internal CustomPropertyValues(int id, string propname, VA.Shapes.CustomProperties.CustomPropertyCells propcells)
 {
     this.ShapeID   = id;
     this.Name      = propname;
     this.Value     = propcells.Value.Formula.Value;
     this.Format    = propcells.Format.Formula.Value;
     this.Invisible = propcells.Invisible.Formula.Value;
     this.Label     = propcells.Label.Formula.Value;
     this.LangId    = propcells.LangId.Formula.Value;
     this.Prompt    = propcells.Prompt.Formula.Value;
     this.SortKey   = propcells.SortKey.Formula.Value;
     this.Type      = propcells.Type.Formula.Value;
     this.Calendar  = propcells.Calendar.Formula.Value;
 }
 public VisioAutomation.Shapes.CustomProperties.CustomPropertyCells GetCells(System.Collections.Generic.IList<ShapeSheet.CellData<double>> row)
 {
     var cells = new VisioAutomation.Shapes.CustomProperties.CustomPropertyCells();
     cells.Value = row[this.Value];
     cells.Calendar = Extensions.CellDataMethods.ToInt(row[this.Calendar]);
     cells.Format = row[this.Format];
     cells.Invisible = Extensions.CellDataMethods.ToInt(row[this.Invis]);
     cells.Label = row[this.Label];
     cells.LangId = Extensions.CellDataMethods.ToInt(row[this.LangID]);
     cells.Prompt = row[this.Prompt];
     cells.SortKey = Extensions.CellDataMethods.ToInt(row[this.SortKey]);
     cells.Type = Extensions.CellDataMethods.ToInt(row[this.Type]);
     cells.Ask = Extensions.CellDataMethods.ToBool(row[this.Ask]);
     return cells;
 }
        public VisioAutomation.Shapes.CustomProperties.CustomPropertyCells GetCells(System.Collections.Generic.IList <ShapeSheet.CellData <double> > row)
        {
            var cells = new VisioAutomation.Shapes.CustomProperties.CustomPropertyCells();

            cells.Value     = row[this.Value];
            cells.Calendar  = Extensions.CellDataMethods.ToInt(row[this.Calendar]);
            cells.Format    = row[this.Format];
            cells.Invisible = Extensions.CellDataMethods.ToInt(row[this.Invis]);
            cells.Label     = row[this.Label];
            cells.LangId    = Extensions.CellDataMethods.ToInt(row[this.LangID]);
            cells.Prompt    = row[this.Prompt];
            cells.SortKey   = Extensions.CellDataMethods.ToInt(row[this.SortKey]);
            cells.Type      = Extensions.CellDataMethods.ToInt(row[this.Type]);
            cells.Ask       = Extensions.CellDataMethods.ToBool(row[this.Ask]);
            return(cells);
        }
        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.CustomProperties.CustomPropertyCells();

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

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

            //cleanup
            page.Delete(0);
        }
示例#8
0
        public void DOM_CustomProperties()
        {
            // Create the doc
            var shape_nodes = new VA.DOM.ShapeList();
            var vrect1      = new VisioAutomation.DOM.Rectangle(1, 1, 9, 9);

            vrect1.Text = new VA.Text.Markup.TextElement("HELLO WORLD");

            vrect1.CustomProperties = new Dictionary <string, VA.Shapes.CustomProperties.CustomPropertyCells>();

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

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

            var cp2 = new VA.Shapes.CustomProperties.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.CustomProperties.CustomPropertyHelper.Contains(vrect1.VisioShape, "FOO"));
            Assert.IsTrue(VA.Shapes.CustomProperties.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.CustomProperties.CustomPropertyCells();

            cp.Value = "Hello World";
            VisioAutomation.Shapes.CustomProperties.CustomPropertyHelper.Set(s1, "Propname", cp);

            // Retrieve all the Custom properties from a shape

            var props = VisioAutomation.Shapes.CustomProperties.CustomPropertyHelper.Get(s1);

            // Delete the property from the shape

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

            //cleanup
            page.Delete(0);
        }
        private void SetFromParameters()
        {
            var cp = new VA.Shapes.CustomProperties.CustomPropertyCells();

            cp.Value = this.Value;

            if (this.Label != null)
            {
                cp.Label = this.Label;
            }

            if (this.Format != null)
            {
                cp.Format = this.Format;
            }

            if (this.Prompt!= null)
            {
                cp.Prompt = this.Prompt;
            }

            if (this.LangId >= 0)
            {
                cp.LangId = this.LangId;
            }

            if (this.SortKey >= 0)
            {
                cp.SortKey = this.SortKey;
            }

            if (this.Type >= 0)
            {
                cp.Type = this.Type;
            }

            if (this.Ask>= 0)
            {
                cp.Ask = this.Ask;
            }

            if (this.Calendar >= 0)
            {
                cp.Calendar = this.Calendar;
            }

            if (this.Invisible >= 0)
            {
                cp.Invisible = this.Invisible;
            }

            this.client.CustomProp.Set(this.Shapes, this.Name, cp);
        }