public IVisio.Page NewPage(VisioScripting.TargetDocument targetdoc, VisioAutomation.Geometry.Size?size, bool isbackgroundpage) { targetdoc = targetdoc.ResolveToDocument(this._client); var pages = targetdoc.Document.Pages; IVisio.Page new_page; using (var undoscope = this._client.Undo.NewUndoScope(nameof(NewPage))) { new_page = pages.Add(); if (size.HasValue) { var targetpages = new TargetPages(new_page); this.SetPageSize(targetpages, size.Value); } if (isbackgroundpage) { new_page.Background = 1; } } return(new_page); }
protected override void ProcessRecord() { var targetdoc = new VisioScripting.TargetDocument(this.Document); targetdoc.ResolveToDocument(this.Client); bool master_specified = this.Name != null; bool doc_specified = this.Document != null; if (master_specified) { foreach (var name in this.Name) { var masters = this.Client.Master.FindMasters(targetdoc, name); this.WriteObject(masters, true); } } else { // master name is not specified if (doc_specified) { this.WriteVerbose("Get all masters from specified document"); var masters = this.Client.Master.GetMasters(targetdoc); this.WriteObject(masters, true); } else { this.WriteVerbose("Get all masters from active document"); var masters = this.Client.Master.GetMasters(targetdoc); this.WriteObject(masters, true); } } }
public void SetActivePage(VisioScripting.TargetDocument targetdoc, Models.PageRelativePosition flags) { targetdoc = targetdoc.ResolveToDocument(this._client); var docpages = targetdoc.Document.Pages; if (docpages.Count < 2) { return; } var pages = docpages; var cmdtarget = this._client.GetCommandTarget(CommandTargetFlags.RequirePage); this._go_to_page(pages, flags, cmdtarget); }
protected override void ProcessRecord() { if (this.ActivePage) { var page_active = this.Client.Page.GetActivePage(); this.WriteObject(page_active); return; } // If the active page is not specified then work on all the pages in a document (user-specified or auto) var targetdoc = new VisioScripting.TargetDocument(this.Document); // First, the ID case if (this.ID != null) { var t = targetdoc.ResolveToDocument(this.Client); foreach (var id in this.ID) { var page = t.Document.Pages[id]; this.WriteObject(page); } return; } // Then, handle the name case if (this.Name == null) { var pages_by_name = this.Client.Page.FindPagesInDocument(targetdoc, null); this.WriteObject(pages_by_name, true); return; } var list_page = new List <IVisio.Page>(); foreach (var name in this.Name) { var pages_by_name = this.Client.Page.FindPagesInDocument(targetdoc, name); list_page.AddRange(pages_by_name); } this.WriteObject(list_page, true); }