Ejemplo n.º 1
0
        protected override void ProcessRecord()
        {
            var target_pages = new VisioScripting.Models.TargetPages(this.Pages);

            var template  = new VisioPowerShell.Models.PageCells();
            var celldic   = VisioPowerShell.Models.NameCellDictionary.FromCells(template);
            var cellnames = celldic.Keys.ToArray();
            var query     = _CreateQuery(celldic, cellnames);
            var surface   = this.Client.ShapeSheet.GetShapeSheetSurface();

            var result_dt = new System.Data.DataTable();

            foreach (var target_page in target_pages.Pages)
            {
                var target_pagesheet = target_page.PageSheet;
                var target_shapeids  = new List <int> {
                    target_pagesheet.ID
                };
                var dt = VisioPowerShell.Models.DataTableHelpers.QueryToDataTable(query, this.OutputType, target_shapeids, surface);
                result_dt.Merge(dt);
            }

            // Annotate the returned datatable to disambiguate rows
            var pageindex_col = result_dt.Columns.Add("PageIndex", typeof(System.Int32));

            pageindex_col.SetOrdinal(0);
            for (int row_index = 0; row_index < target_pages.Pages.Count; row_index++)
            {
                result_dt.Rows[row_index][pageindex_col.ColumnName] = target_pages.Pages[row_index].Index;
            }

            this.WriteObject(result_dt);
        }
Ejemplo n.º 2
0
        protected override void ProcessRecord()
        {
            var targetdoc = new VisioScripting.TargetDocument(this.Document);

            this.Client.Output.WriteVerbose("Creating a new page");
            var page = this.Client.Page.NewPage(targetdoc, null, false);

            if (this.Name != null)
            {
                if (this.Name.Length == 0)
                {
                    throw new System.ArgumentException("Name can't be empty");
                }

                string n = this.Name.Trim();

                if (n.Length == 0)
                {
                    throw new System.ArgumentException("Name can't be empty");
                }

                this.Client.Output.WriteVerbose("Setting page name \"{0}\"", n);
                page.NameU = n;
            }

            if (this.Width > 0 || this.Height > 0)
            {
                // width and height are used and there isn't a PageCells object
                // then create one
                this.Cells = this.Cells ?? new Models.PageCells();
                if (this.Width > 0)
                {
                    this.Cells.PageWidth = this.Width.ToString(CultureInfo.InvariantCulture);
                }
                if (this.Height > 0)
                {
                    this.Cells.PageHeight = this.Height.ToString(CultureInfo.InvariantCulture);
                }
            }

            if (this.Cells != null)
            {
                var targetpage_shapesheet   = page.PageSheet;
                int targetpage_shapesheetid = targetpage_shapesheet.ID;

                var writer = new VisioAutomation.ShapeSheet.Writers.SidSrcWriter();
                writer.BlastGuards  = true;
                writer.TestCircular = true;
                this.Cells.Apply(writer, (short)targetpage_shapesheetid);

                this.Client.Output.WriteVerbose("Updating Cells for new page");
                writer.Commit(page, VisioAutomation.ShapeSheet.CellValueType.Formula);
            }

            this.WriteObject(page);
        }
Ejemplo n.º 3
0
 protected override void ProcessRecord()
 {
     if (Count < 0)
     {
         var cells = new VisioPowerShell.Models.PageCells();
         this.WriteObject(cells);
     }
     else
     {
         var list_cells = new List <VisioPowerShell.Models.PageCells>(this.Count);
         var indices    = Enumerable.Range(0, this.Count);
         var enum_cells = indices.Select(i => new VisioPowerShell.Models.PageCells());
         list_cells.AddRange(enum_cells);
         this.WriteObject(list_cells, false);
     }
 }
Ejemplo n.º 4
0
        protected override void ProcessRecord()
        {
            var cells = new VisioPowerShell.Models.PageCells();

            this.WriteObject(cells);
        }