protected override void ProcessRecord()
 {
     var cellsize = new VA.Drawing.Size(CellWidth, CellHeight);
     var layout = new GRID.GridLayout(this.Columns, this.Rows, cellsize, this.Master);
     layout.CellSpacing = new VA.Drawing.Size(this.CellHorizontalSpacing, this.CellVerticalSpacing);
     layout.RowDirection = this.RowDirection;
     layout.ColumnDirection = this.ColumnDirection;
     this.WriteObject(layout);
 }
Exemplo n.º 2
0
        protected override void ProcessRecord()
        {
            var cellsize = new VA.Drawing.Size(CellWidth, CellHeight);
            var layout   = new GRID.GridLayout(this.Columns, this.Rows, cellsize, this.Master);

            layout.CellSpacing     = new VA.Drawing.Size(this.CellHorizontalSpacing, this.CellVerticalSpacing);
            layout.RowDirection    = this.RowDirection;
            layout.ColumnDirection = this.ColumnDirection;
            this.WriteObject(layout);
        }
Exemplo n.º 3
0
        public static void GradientTransparencies()
        {
            int num_cols = 1;
            int num_rows = 10;
            var color1   = new ColorRGB(0xff000);
            var color2   = new ColorRGB(0x000ff);

            var page_size = new VA.Drawing.Size(num_rows / 2.0, num_rows);
            var upperleft = new VA.Drawing.Point(0, page_size.Height);

            var page    = SampleEnvironment.Application.ActiveDocument.Pages.Add();
            var app     = page.Application;
            var docs    = app.Documents;
            var stencil = docs.OpenStencil("basic_U.vss");
            var master  = stencil.Masters["Rectangle"];

            SampleEnvironment.SetPageSize(page, page_size);

            var layout = new GRIDMODEL.GridLayout(num_cols, num_rows, new VA.Drawing.Size(6.0, 1.0), master);

            layout.RowDirection = GRIDMODEL.RowDirection.TopToBottom;
            layout.Origin       = upperleft;
            layout.CellSpacing  = new VA.Drawing.Size(0.1, 0.1);
            layout.PerformLayout();

            double[] trans = EffectsSamples.RangeSteps(0.0, 1.0, num_rows).ToArray();

            int i = 0;

            foreach (var node in layout.Nodes)
            {
                double transparency = trans[i];

                var fmt = new VA.DOM.ShapeCells();
                node.Cells = fmt;

                fmt.FillPattern      = 25; // Linear pattern left to right
                fmt.FillForegnd      = color1.ToFormula();
                fmt.FillBkgnd        = color2.ToFormula();
                fmt.FillForegndTrans = 0;
                fmt.FillBkgndTrans   = transparency;
                fmt.LinePattern      = 0;

                node.Text = string.Format("bg trans = {0}%", transparency);
                i++;
            }

            layout.Render(page);

            page.ResizeToFitContents();
        }
        public static void GradientTransparencies()
        {
            int num_cols = 1;
            int num_rows = 10;
            var color1 = new VA.Drawing.ColorRGB(0xff000);
            var color2 = new VA.Drawing.ColorRGB(0x000ff);

            var page_size = new VA.Drawing.Size(num_rows/2.0, num_rows);
            var upperleft = new VA.Drawing.Point(0, page_size.Height);

            var page = SampleEnvironment.Application.ActiveDocument.Pages.Add();
            var app = page.Application;
            var docs = app.Documents;
            var stencil = docs.OpenStencil("basic_U.vss");
            var master = stencil.Masters["Rectangle"];

            SampleEnvironment.SetPageSize(page,page_size);

            var layout = new GRIDMODEL.GridLayout(num_cols, num_rows, new VA.Drawing.Size(6.0, 1.0), master);
            layout.RowDirection = GRIDMODEL.RowDirection.TopToBottom;
            layout.Origin = upperleft;
            layout.CellSpacing = new VA.Drawing.Size(0.1, 0.1);
            layout.PerformLayout();

            double[] trans = RangeSteps(0.0, 1.0, num_rows).ToArray();

            int i = 0;
            foreach (var node in layout.Nodes)
            {
                double transparency = trans[i];

                var fmt = new VA.DOM.ShapeCells();
                node.Cells = fmt;

                fmt.FillPattern = 25; // Linear pattern left to right
                fmt.FillForegnd = color1.ToFormula();
                fmt.FillBkgnd = color2.ToFormula();
                fmt.FillForegndTrans = 0;
                fmt.FillBkgndTrans = transparency;
                fmt.LinePattern = 0;

                node.Text = string.Format("bg trans = {0}%", transparency);
                i++;
            }

            layout.Render(page);

            page.ResizeToFitContents();
        }
Exemplo n.º 5
0
        public void Grid(GRIDLAYOUT.GridLayout layout)
        {
            this.AssertApplicationAvailable();
            this.AssertDocumentAvailable();

            //Create a new page to hold the grid
            var application = this.Client.VisioApplication;
            var page        = application.ActivePage;

            layout.PerformLayout();

            using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication, "Draw Grid"))
            {
                layout.Render(page);
            }
        }
Exemplo n.º 6
0
        public void Grid(VAGRID.GridLayout layout)
        {
            this._client.Application.AssertApplicationAvailable();
            this._client.Document.AssertDocumentAvailable();

            //Create a new page to hold the grid
            var application = this._client.Application.Get();
            var page        = application.ActivePage;

            layout.PerformLayout();

            using (var undoscope = this._client.Application.NewUndoScope("Draw Grid"))
            {
                layout.Render(page);
            }
        }
Exemplo n.º 7
0
        public IList<IVisio.Shape> Table(System.Data.DataTable datatable,
            IList<double> widths,
            IList<double> heights,
            VA.Drawing.Size cellspacing)
        {
            this.AssertApplicationAvailable();
            this.AssertDocumentAvailable();

            if (datatable == null)
            {
                throw new System.ArgumentNullException("datatable");
            }

            if (widths == null)
            {
                throw new System.ArgumentNullException("widths");
            }

            if (heights == null)
            {
                throw new System.ArgumentNullException("heights");
            }

            if (datatable.Rows.Count < 1)
            {
                return new List<IVisio.Shape>(0);
            }

            string master = "Rectangle";
            string stencil = "basic_u.vss";
            var stencildoc = this.Client.Document.OpenStencil(stencil);
            var stencildoc_masters = stencildoc.Masters;
            var masterobj = stencildoc_masters.ItemU[master];

            var application = this.Client.VisioApplication;
            var active_document = application.ActiveDocument;
            var pages = active_document.Pages;

            var page = pages.Add();
            page.Background = 0; // ensure this is a foreground page

            var pagesize = this.Client.Page.GetSize();

            var layout = new GRIDLAYOUT.GridLayout(datatable.Columns.Count, datatable.Rows.Count, new VA.Drawing.Size(1, 1), masterobj);
            layout.Origin = new VA.Drawing.Point(0, pagesize.Height);
            layout.CellSpacing = cellspacing;
            layout.RowDirection = GRIDLAYOUT.RowDirection.TopToBottom;
            layout.PerformLayout();

            foreach (var i in Enumerable.Range(0, datatable.Rows.Count))
            {
                var row = datatable.Rows[i];

                for (int col_index = 0; col_index < row.ItemArray.Length; col_index++)
                {
                    var col = row.ItemArray[col_index];
                    var cur_label = (col != null) ? col.ToString() : string.Empty;
                    var node = layout.GetNode(col_index, i);
                    node.Text = cur_label;
                }
            }

            using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication, "Draw Table"))
            {
                layout.Render(page);
                page.ResizeToFitContents();
            }

            var page_shapes = page.Shapes;
            var shapes = layout.Nodes.Select(n => n.Shape).ToList();
            return shapes;
        }
Exemplo n.º 8
0
        public IList <IVisio.Shape> Table(System.Data.DataTable datatable,
                                          IList <double> widths,
                                          IList <double> heights,
                                          VA.Drawing.Size cellspacing)
        {
            this.AssertApplicationAvailable();
            this.AssertDocumentAvailable();

            if (datatable == null)
            {
                throw new System.ArgumentNullException("datatable");
            }

            if (widths == null)
            {
                throw new System.ArgumentNullException("widths");
            }

            if (heights == null)
            {
                throw new System.ArgumentNullException("heights");
            }

            if (datatable.Rows.Count < 1)
            {
                return(new List <IVisio.Shape>(0));
            }


            string master             = "Rectangle";
            string stencil            = "basic_u.vss";
            var    stencildoc         = this.Client.Document.OpenStencil(stencil);
            var    stencildoc_masters = stencildoc.Masters;
            var    masterobj          = stencildoc_masters.ItemU[master];

            var application     = this.Client.VisioApplication;
            var active_document = application.ActiveDocument;
            var pages           = active_document.Pages;

            var page = pages.Add();

            page.Background = 0; // ensure this is a foreground page

            var pagesize = this.Client.Page.GetSize();

            var layout = new GRIDLAYOUT.GridLayout(datatable.Columns.Count, datatable.Rows.Count, new VA.Drawing.Size(1, 1), masterobj);

            layout.Origin       = new VA.Drawing.Point(0, pagesize.Height);
            layout.CellSpacing  = cellspacing;
            layout.RowDirection = GRIDLAYOUT.RowDirection.TopToBottom;
            layout.PerformLayout();

            foreach (var i in Enumerable.Range(0, datatable.Rows.Count))
            {
                var row = datatable.Rows[i];

                for (int col_index = 0; col_index < row.ItemArray.Length; col_index++)
                {
                    var col       = row.ItemArray[col_index];
                    var cur_label = (col != null) ? col.ToString() : string.Empty;
                    var node      = layout.GetNode(col_index, i);
                    node.Text = cur_label;
                }
            }

            using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication, "Draw Table"))
            {
                layout.Render(page);
                page.ResizeToFitContents();
            }

            var page_shapes = page.Shapes;
            var shapes      = layout.Nodes.Select(n => n.Shape).ToList();

            return(shapes);
        }
        public static void DrawAllGradients()
        {
            var app = SampleEnvironment.Application;
            var docs = app.Documents;
            var stencil = docs.OpenStencil("basic_u.vss");
            var master = stencil.Masters["Rectangle"];
            var page = SampleEnvironment.Application.ActiveDocument.Pages.Add();

            int num_cols = 7;
            int num_rows = 7;

            var page_size = new VA.Drawing.Size(5, 5);
            SampleEnvironment.SetPageSize(page,page_size);

            var lowerleft = new VA.Drawing.Point(0, 0);
            var actual_page_size = SampleEnvironment.GetPageSize(page);
            var page_rect = new VA.Drawing.Rectangle(lowerleft, actual_page_size);

            var layout = new GRIDMODEL.GridLayout(num_cols, num_rows, new VA.Drawing.Size(1, 1), master);
            layout.RowDirection = GRIDMODEL.RowDirection.TopToBottom;
            layout.Origin = page_rect.UpperLeft;
            layout.CellSpacing = new VA.Drawing.Size(0, 0);
            layout.PerformLayout();

            int max_grad_id = 40;
            int n = 0;

            foreach (var node in layout.Nodes)
            {
                int grad_id = n%max_grad_id;
                node.Text = grad_id.ToString();
                n++;
            }

            layout.Render(page);

            var color1 = new VA.Drawing.ColorRGB(0xffdddd);
            var color2 = new VA.Drawing.ColorRGB(0x00ffff);

            var format = new VA.Shapes.FormatCells();

            var update = new VA.ShapeSheet.Update();

            string color1_formula = color1.ToFormula();
            string color2_formula = color2.ToFormula();

            n = 0;

            foreach (var node in layout.Nodes)
            {
                short shapeid = node.ShapeID;
                int grad_id = n%max_grad_id;

                format.FillPattern = grad_id;
                format.FillForegnd = color1_formula;
                format.FillBkgnd = color2_formula;
                format.LinePattern = 0;
                format.LineWeight = 0;
                update.SetFormulas(shapeid, format);

                n++;
            }

            update.Execute(page);

            var bordersize = new VA.Drawing.Size(1, 1);
            page.ResizeToFitContents(bordersize);
        }
Exemplo n.º 10
0
        public static void DrawAllGradients()
        {
            var app     = SampleEnvironment.Application;
            var docs    = app.Documents;
            var stencil = docs.OpenStencil("basic_u.vss");
            var master  = stencil.Masters["Rectangle"];
            var page    = SampleEnvironment.Application.ActiveDocument.Pages.Add();

            int num_cols = 7;
            int num_rows = 7;

            var page_size = new VA.Drawing.Size(5, 5);

            SampleEnvironment.SetPageSize(page, page_size);

            var lowerleft        = new VA.Drawing.Point(0, 0);
            var actual_page_size = SampleEnvironment.GetPageSize(page);
            var page_rect        = new VA.Drawing.Rectangle(lowerleft, actual_page_size);

            var layout = new GRIDMODEL.GridLayout(num_cols, num_rows, new VA.Drawing.Size(1, 1), master);

            layout.RowDirection = GRIDMODEL.RowDirection.TopToBottom;
            layout.Origin       = page_rect.UpperLeft;
            layout.CellSpacing  = new VA.Drawing.Size(0, 0);
            layout.PerformLayout();

            int max_grad_id = 40;
            int n           = 0;

            foreach (var node in layout.Nodes)
            {
                int grad_id = n % max_grad_id;
                node.Text = grad_id.ToString();
                n++;
            }

            layout.Render(page);

            var color1 = new VA.Drawing.ColorRGB(0xffdddd);
            var color2 = new VA.Drawing.ColorRGB(0x00ffff);

            var format = new VA.Shapes.FormatCells();

            var update = new VA.ShapeSheet.Update();

            string color1_formula = color1.ToFormula();
            string color2_formula = color2.ToFormula();

            n = 0;

            foreach (var node in layout.Nodes)
            {
                short shapeid = node.ShapeID;
                int   grad_id = n % max_grad_id;

                format.FillPattern = grad_id;
                format.FillForegnd = color1_formula;
                format.FillBkgnd   = color2_formula;
                format.LinePattern = 0;
                format.LineWeight  = 0;
                update.SetFormulas(shapeid, format);

                n++;
            }

            update.Execute(page);

            var bordersize = new VA.Drawing.Size(1, 1);

            page.ResizeToFitContents(bordersize);
        }