public void SetShapeCells(TargetShapeIDs targets, Dictionary <string, string> hashtable, bool blast_guards, bool test_circular) { var writer = new SidSrcWriter(); writer.BlastGuards = blast_guards; writer.TestCircular = test_circular; var cellmap = CellSrcDictionary.GetCellMapForShapes(); var valuemap = new CellValueDictionary(cellmap, hashtable); foreach (var shape_id in targets.ShapeIDs) { foreach (var cellname in valuemap.Keys) { string cell_value = valuemap[cellname]; var cell_src = valuemap.GetSrc(cellname); writer.SetFormula((short)shape_id, cell_src, cell_value); } } var surface = this._client.ShapeSheet.GetShapeSheetSurface(); this._client.WriteVerbose("BlastGuards: {0}", blast_guards); this._client.WriteVerbose("TestCircular: {0}", test_circular); this._client.WriteVerbose("Number of Shapes : {0}", targets.ShapeIDs.Count); using (var undoscope = this._client.Application.NewUndoScope("Set Shape Cells")) { this._client.WriteVerbose("Start Update"); writer.Commit(surface); this._client.WriteVerbose("End Update"); } }
protected void DumpValues(CellValueDictionary cellvalues) { this.WriteVerbose(String.Format("CellValues contains {0} items", cellvalues.CellNames.Count)); foreach (var cellname in cellvalues.CellNames) { string cell_value = cellvalues[cellname]; this.WriteVerbose("{0} = {1}", cellname, cell_value); } }
protected void DumpValues(CellValueDictionary cellvalues) { this.WriteVerbose($"CellValues contains {cellvalues.CellNames.Count} items"); foreach (var cellname in cellvalues.CellNames) { string cell_value = cellvalues[cellname]; this.WriteVerbose("{0} = {1}", cellname, cell_value); } }
protected override void ProcessRecord() { var update = new VisioAutomation.ShapeSheet.Update(); update.BlastGuards = this.BlastGuards; update.TestCircular = this.TestCircular; var cellmap = CellSRCDictionary.GetCellMapForShapes(); var valuemap = new CellValueDictionary(cellmap, this.Hashtable); var target_shapes = this.Shapes ?? this.Client.Selection.GetShapes(); this.DumpValues(valuemap); foreach (var shape in target_shapes) { var id = shape.ID16; foreach (var cellname in valuemap.CellNames) { string cell_value = valuemap[cellname]; var cell_src = valuemap.GetSRC(cellname); update.SetFormulaIgnoreNull(id, cell_src, cell_value); } } var surface = this.Client.ShapeSheet.GetShapeSheetSurface(); this.WriteVerbose("BlastGuards: {0}", this.BlastGuards); this.WriteVerbose("TestCircular: {0}", this.TestCircular); this.WriteVerbose("Number of Shapes : {0}", target_shapes.Count); this.WriteVerbose("Number of Total Updates: {0}", update.Count()); using (var undoscope = this.Client.Application.NewUndoScope("SetShapeCells")) { this.WriteVerbose("Start Update"); update.Execute(surface); this.WriteVerbose("End Update"); } }
protected override void ProcessRecord() { var update = new VisioAutomation.ShapeSheet.Update(); update.BlastGuards = this.BlastGuards; update.TestCircular = this.TestCircular; var cellmap = CellSRCDictionary.GetCellMapForShapes(); var valuemap = new CellValueDictionary(cellmap, this.Hashtable); var target_shapes = this.Shapes ?? this.client.Selection.GetShapes(); this.DumpValues(valuemap); foreach (var shape in target_shapes) { var id = shape.ID16; foreach (var cellname in valuemap.CellNames) { string cell_value = valuemap[cellname]; var cell_src = valuemap.GetSRC(cellname); update.SetFormulaIgnoreNull(id,cell_src, cell_value); } } var surface = this.client.ShapeSheet.GetShapeSheetSurface(); this.WriteVerbose("BlastGuards: {0}", this.BlastGuards); this.WriteVerbose("TestCircular: {0}", this.TestCircular); this.WriteVerbose("Number of Shapes : {0}", target_shapes.Count); this.WriteVerbose("Number of Total Updates: {0}", update.Count()); using (var undoscope = this.client.Application.NewUndoScope( "SetShapeCells")) { this.WriteVerbose("Start Update"); update.Execute(surface); this.WriteVerbose("End Update"); } }
protected override void ProcessRecord() { var update = new VisioAutomation.ShapeSheet.Update(); update.BlastGuards = this.BlastGuards; update.TestCircular = this.TestCircular; var target_pages = this.Pages ?? new[] { this.client.Page.Get() }; var cellmap = CellSRCDictionary.GetCellMapForPages(); var valuemap = new CellValueDictionary(cellmap, this.Hashtable); this.DumpValues(valuemap); foreach (var page in target_pages) { var pagesheet = page.PageSheet; foreach (var cellname in valuemap.CellNames) { string cell_value = valuemap[cellname]; var cell_src = valuemap.GetSRC(cellname); update.SetFormulaIgnoreNull(cell_src, cell_value); } this.WriteVerbose("BlastGuards: {0}", this.BlastGuards); this.WriteVerbose("TestCircular: {0}", this.TestCircular); this.WriteVerbose("Number of Shapes : {0}", 1); this.WriteVerbose("Number of Total Updates: {0}", update.Count()); var application = this.client.Application.Get(); using (var undoscope = this.client.Application.NewUndoScope("SetPageCells")) { this.WriteVerbose("Start Update"); update.Execute(pagesheet); this.WriteVerbose("End Update"); } } }