public void Scripting_Hyperlinks_Scenarios()
        {
            var client = this.GetScriptingClient();

            client.Document.New();
            client.Page.New(new VisioAutomation.Drawing.Size(4, 4), false);

            var s1 = client.Draw.Rectangle(1, 1, 1.5, 1.5);

            var s2 = client.Draw.Rectangle(2, 3, 2.5, 3.5);

            var s3 = client.Draw.Rectangle(1.5, 3.5, 2, 4.0);

            client.Selection.SelectNone();
            client.Selection.Select(s1);
            client.Selection.Select(s2);
            client.Selection.Select(s3);

            var targets = new VisioAutomation.Scripting.TargetShapes();


            var hyperlinks0 = client.Hyperlink.Get(targets);

            Assert.AreEqual(3, hyperlinks0.Count);
            Assert.AreEqual(0, hyperlinks0[s1].Count);
            Assert.AreEqual(0, hyperlinks0[s2].Count);
            Assert.AreEqual(0, hyperlinks0[s3].Count);

            var hyperlink = new VisioAutomation.Shapes.Hyperlinks.HyperlinkCells();

            hyperlink.Address = "http://www.microsoft.com";
            client.Hyperlink.Add(targets, hyperlink);


            var hyperlinks1 = client.Hyperlink.Get(targets);

            Assert.AreEqual(3, hyperlinks1.Count);
            Assert.AreEqual(1, hyperlinks1[s1].Count);
            Assert.AreEqual(1, hyperlinks1[s2].Count);
            Assert.AreEqual(1, hyperlinks1[s3].Count);

            client.Hyperlink.Delete(targets, 0);
            var hyperlinks2 = client.Hyperlink.Get(targets);

            Assert.AreEqual(3, hyperlinks0.Count);
            Assert.AreEqual(0, hyperlinks2[s1].Count);
            Assert.AreEqual(0, hyperlinks2[s2].Count);
            Assert.AreEqual(0, hyperlinks2[s3].Count);

            client.Document.Close(true);
        }
예제 #2
0
        protected override void ProcessRecord()
        {
            var hlink = new VA.Shapes.Hyperlinks.HyperlinkCells();

            hlink.Address     = this.Address;
            hlink.Description = this.Description;
            hlink.ExtraInfo   = this.ExtraInfo;
            hlink.Frame       = this.Frame;
            hlink.SortKey     = this.SortKey;

            hlink.SubAddress = this.SubAddress;

            hlink.Default   = VA.Convert.BoolToFormula(this.Default);
            hlink.NewWindow = VA.Convert.BoolToFormula(this.NewWindow);
            hlink.Invisible = VA.Convert.BoolToFormula(this.Invisible);

            this.Client.Hyperlink.Add(this.Shapes, hlink);
        }
예제 #3
0
        public VisioAutomation.Shapes.Hyperlinks.HyperlinkCells GetCells(System.Collections.Generic.IList <ShapeSheet.CellData <double> > row)
        {
            var cells = new VisioAutomation.Shapes.Hyperlinks.HyperlinkCells();

            // cells.X = Extensions.CellDataMethods.ToInt(row[this.X]);

            cells.Address     = row[this.Address].Formula;
            cells.Description = row[this.Description].Formula;
            cells.ExtraInfo   = row[this.ExtraInfo].Formula;
            cells.Frame       = row[this.Frame].Formula;
            cells.SortKey     = row[this.SortKey].Formula;
            cells.SubAddress  = row[this.SubAddress].Formula;

            cells.NewWindow = Extensions.CellDataMethods.ToBool(row[this.NewWindow]);
            cells.Default   = Extensions.CellDataMethods.ToBool(row[this.Default].Formula);
            cells.Invisible = Extensions.CellDataMethods.ToBool(row[this.Invisible].Formula);

            return(cells);
        }