Example #1
0
        public void EntitytoPage()
        {
            List <IVShape> shapes = new List <IVShape>();

            foreach (IVShape shape in this._application.ActivePage.Shapes)
            {
                if (shape.Name.Contains("Context Entity (CE)"))
                {
                    bool exists = false;
                    foreach (var s in shapes)
                    {
                        if (s.Text == shape.Text)
                        {
                            exists = true; System.Windows.Forms.MessageBox.Show(shape.Text +
                                                                                " already exists.");
                        }
                    }
                    if (exists == false)
                    {
                        shapes.Add(shape);
                    }
                }
            }
            if (shapes.Count >= 1)
            {
                foreach (var shape in shapes)
                {
                    IVPage page = this._application.ActiveDocument.Pages.Add();
                    page.Name = shape.Text;
                    IVDocument stencil      = this._application.Documents.OpenEx("SMT_BeC.vssx", 4);
                    IVMaster   masterentity = new IVMaster();
                    foreach (var m in stencil.Masters)
                    {
                        if (m.Name == "Context Entity/ Function")
                        {
                            masterentity = m;
                        }
                    }
                    IVShape shapeh = page.Drop(masterentity, 10.3 / 2.54, 20.5 / 2.54);
                    shapeh.Text = shape.Text;
                    shapeh.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))";
                    IVHyperlink hl = shape.Hyperlinks.Add();
                    hl.SubAddress = page.Name;
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("No Context Entity found.");
            };
        }