protected override void ProcessRecord() { if (this.FitContents) { var bordersize = new VisioAutomation.Geometry.Size(this.BorderWidth, this.BorderWidth); this.Client.Page.ResizeToFitContents(bordersize, true); } if (this.Width > 0 || this.Height > 0) { var page = this.Client.Application.Get().ActivePage; var old_page_format_cells = VisioAutomation.Pages.PageFormatCells.GetCells(page.PageSheet, CellValueType.Formula); var new_page_format_cells = new VisioAutomation.Pages.PageFormatCells(); if (this.Width > 0) { new_page_format_cells.Width = this.Width; } if (this.Height > 0) { new_page_format_cells.Height = this.Height; } var writer = new VisioAutomation.ShapeSheet.Writers.SrcWriter(); new_page_format_cells.SetFormulas(writer); writer.BlastGuards = true; writer.Commit(page); } }
protected override void ProcessRecord() { if (this.FitContents || this.Width > 0 || this.Height > 0) { var cmdtarget = this.Client.GetCommandTargetPage(); var tp = new VisioScripting.Models.TargetPages(cmdtarget.ActivePage); if (this.FitContents) { var bordersize = new VisioAutomation.Geometry.Size(this.BorderWidth, this.BorderWidth); this.Client.Page.ResizePageToFitContents(tp, bordersize); this.Client.View.SetActiveWindowZoomToObject(VisioScripting.Models.ZoomToObject.Page); } if (this.Width > 0 || this.Height > 0) { var page_format_cells = new VisioAutomation.Pages.PageFormatCells(); if (this.Width > 0) { page_format_cells.Width = this.Width; } if (this.Height > 0) { page_format_cells.Height = this.Height; } this.Client.Page.SetPageFormatCells(tp, page_format_cells); } } if (this.Orientation.HasValue) { var cmdtarget = this.Client.GetCommandTargetPage(); var tp = new VisioScripting.Models.TargetPages(cmdtarget.ActivePage); this.Client.Page.SetPageOrientation(tp, this.Orientation.Value); } if (this.BackgroundPage != null) { this.Client.Page.SetActivePageBackground(this.BackgroundPage); } if (this.LayoutStyle != null) { var cmdtarget = this.Client.GetCommandTargetPage(); var tp = new VisioScripting.Models.TargetPage(cmdtarget.ActivePage); this.Client.Page.LayoutPage(tp, this.LayoutStyle); } }
public void SetPageFormatCells(Models.TargetPages targetpages, VisioAutomation.Pages.PageFormatCells cells) { var pages = targetpages.Resolve(this._client); using (var undoscope = this._client.Undo.NewUndoScope(nameof(SetPageFormatCells))) { foreach (var page in pages) { var writer = new VisioAutomation.ShapeSheet.Writers.SrcWriter(); writer.SetValues(cells); writer.BlastGuards = true; writer.CommitFormulas(page); } } }
protected override void ProcessRecord() { var targetpages = new VisioScripting.TargetPages(this.Page).ResolveToPages(this.Client); if (this.FitContents) { var bordersize = new VisioAutomation.Geometry.Size(this.BorderWidth, this.BorderHeight); this.Client.Page.ResizePageToFitContents(targetpages, bordersize); this.Client.View.SetZoomToObject(VisioScripting.TargetWindow.Auto, VisioScripting.Models.ZoomToObject.Page); } if (this.Width > 0 || this.Height > 0) { var page_format_cells = new VisioAutomation.Pages.PageFormatCells(); if (this.Width > 0) { page_format_cells.Width = this.Width; } if (this.Height > 0) { page_format_cells.Height = this.Height; } this.Client.Page.SetPageFormatCells(targetpages, page_format_cells); } if (this.Orientation.HasValue) { this.Client.Page.SetPageOrientation(targetpages, this.Orientation.Value); } if (this.BackgroundPage != null) { this.Client.Page.SetPageBackground(targetpages, this.BackgroundPage); } if (this.LayoutStyle != null) { this.Client.Page.LayoutPage(targetpages, this.LayoutStyle); } }
public IVisio.Document NewDocumentFromTemplate(VisioAutomation.Geometry.Size size, string template) { var cmdtarget = this._client.GetCommandTargetApplication(); var doc = this.NewDocumentFromTemplate(template); var pagecells = new VisioAutomation.Pages.PageFormatCells(); pagecells.Width = size.Width; pagecells.Height = size.Height; var pages = doc.Pages; var page = pages[1]; var writer = new VisioAutomation.ShapeSheet.Writers.SrcWriter(); writer.SetValues(pagecells); writer.Commit(page.PageSheet, CellValueType.Formula); return(doc); }