public static void ProgressBar()
        {
            var page_a = SampleEnvironment.Application.ActiveDocument.Pages.Add();


            // Draw some shapes
            var background = page_a.DrawRectangle(0, 0, 5, 1);
            var progress   = page_a.DrawRectangle(0, 0, 1, 1);

            var background_fmt = new VA.Shapes.ShapeFormatCells();

            background_fmt.FillForeground = "rgb(240,240,240)";
            background_fmt.LineColor      = "rgb(100,100,100)";


            var progress_fmt = new VA.Shapes.ShapeFormatCells();

            progress_fmt.FillForeground = "rgb(100,150,240)";
            progress_fmt.LineColor      = "rgb(100,100,100)";

            // group the two shapes together
            page_a.Application.ActiveWindow.SelectAll();
            var group = page_a.Application.ActiveWindow.Selection.Group();

            // Set the progress shape update itself based on its position
            string bkname = background.NameID;
            var    xfrm   = new VA.Shapes.ShapeXFormCells();

            xfrm.PinX   = string.Format("GUARD({0}!PinX-{0}!LocPinX+LocPinX)", bkname);
            xfrm.PinY   = string.Format("GUARD({0}!PinY)", bkname);
            xfrm.Width  = string.Format("GUARD({0}!Width*(PAGENUMBER()/PAGECOUNT()))", bkname);
            xfrm.Height = string.Format("GUARD({0}!Height)", bkname);

            var writer = new SidSrcWriter();

            xfrm.SetFormulas(writer, progress.ID16);
            background_fmt.SetFormulas(writer, progress.ID16);
            progress_fmt.SetFormulas(writer, progress.ID16);

            writer.Commit(page_a);

            var markup1 = new VisioAutomation.Models.Text.Element();

            markup1.AddField(VisioAutomation.Models.Text.FieldConstants.PageName);
            markup1.AddText(" (");
            markup1.AddField(VisioAutomation.Models.Text.FieldConstants.PageNumber);
            markup1.AddText(" of ");
            markup1.AddField(VisioAutomation.Models.Text.FieldConstants.NumberOfPages);
            markup1.AddText(") ");
            markup1.SetText(group);
        }
Example #2
0
        public static void TextMarkup14()
        {
            var page = SampleEnvironment.Application.ActiveDocument.Pages.Add();

            // Create the Shapes that will hold the text
            var s1 = page.DrawRectangle(0, 0, 8.5, 11);
            var e1 = new VisioAutomation.Models.Text.Element();

            e1.AddText("This shape is ");
            e1.AddField(VisioAutomation.Models.Text.FieldConstants.Width);
            e1.AddText("inches wide by ");
            e1.AddField(VisioAutomation.Models.Text.FieldConstants.Height);
            e1.AddText("inches tall.");
            e1.SetText(s1);
        }
Example #3
0
        public static void TextFields()
        {
            var page = SampleEnvironment.Application.ActiveDocument.Pages.Add();
            var s0   = page.DrawRectangle(1, 1, 4, 4);

            var markup1 = new VisioAutomation.Models.Text.Element();

            markup1.AddField(VisioAutomation.Models.Text.FieldConstants.PageName);
            markup1.AddText(" (");
            markup1.AddField(VisioAutomation.Models.Text.FieldConstants.PageNumber);
            markup1.AddText(" of ");
            markup1.AddField(VisioAutomation.Models.Text.FieldConstants.NumberOfPages);
            markup1.AddText(") ");
            markup1.SetText(s0);
        }