private void addcell(VA.ShapeSheet.Query.CellQuery query, bool switchpar, string cellname) { var dic = Get_VisioPageCell.GetPageCellDictionary(); if (switchpar) { query.Columns.Add(dic[cellname], cellname); } }
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 valuemap = new CellValueMap(Get_VisioPageCell.GetPageCellDictionary()); valuemap.UpdateValueMap(this.Hashtable); valuemap.SetIf("PageBottomMargin", this.PageBottomMargin); valuemap.SetIf("PageHeight", this.PageHeight); valuemap.SetIf("PageLeftMargin", this.PageLeftMargin); valuemap.SetIf("PageLineJumpDirX", this.PageLineJumpDirX); valuemap.SetIf("PageLineJumpDirY", this.PageLineJumpDirY); valuemap.SetIf("PageRightMargin", this.PageRightMargin); valuemap.SetIf("PageScale", this.PageScale); valuemap.SetIf("PageShapeSplit", this.PageShapeSplit); valuemap.SetIf("PageTopMargin", this.PageTopMargin); valuemap.SetIf("PageWidth", this.PageWidth); valuemap.SetIf("CenterX", this.CenterX); valuemap.SetIf("CenterY", this.CenterY); valuemap.SetIf("PaperKind", this.PaperKind); valuemap.SetIf("PrintGrid", this.PrintGrid); valuemap.SetIf("PrintPageOrientation", this.PrintPageOrientation); valuemap.SetIf("ScaleX", this.ScaleX); valuemap.SetIf("ScaleY", this.ScaleY); valuemap.SetIf("PaperSource", this.PaperSource); valuemap.SetIf("DrawingScale", this.DrawingScale); valuemap.SetIf("DrawingScaleType", this.DrawingScaleType); valuemap.SetIf("DrawingSizeType", this.DrawingSizeType); valuemap.SetIf("InhibitSnap", this.InhibitSnap); valuemap.SetIf("ShdwObliqueAngle", this.ShdwObliqueAngle); valuemap.SetIf("ShdwOffsetX", this.ShdwOffsetX); valuemap.SetIf("ShdwOffsetY", this.ShdwOffsetY); valuemap.SetIf("ShdwScaleFactor", this.ShdwScaleFactor); valuemap.SetIf("ShdwType", this.ShdwType); valuemap.SetIf("UIVisibility", this.UIVisibility); valuemap.SetIf("XGridDensity", this.XGridDensity); valuemap.SetIf("XGridOrigin", this.XGridOrigin); valuemap.SetIf("XGridSpacing", this.XGridSpacing); valuemap.SetIf("XRulerDensity", this.XRulerDensity); valuemap.SetIf("XRulerOrigin", this.XRulerOrigin); valuemap.SetIf("YGridDensity", this.YGridDensity); valuemap.SetIf("YGridOrigin", this.YGridOrigin); valuemap.SetIf("YGridSpacing", this.YGridSpacing); valuemap.SetIf("YRulerDensity", this.YRulerDensity); valuemap.SetIf("YRulerOrigin", this.YRulerOrigin); valuemap.SetIf("AvenueSizeX", this.AvenueSizeX); valuemap.SetIf("AvenueSizeY", this.AvenueSizeY); valuemap.SetIf("BlockSizeX", this.BlockSizeX); valuemap.SetIf("BlockSizeY", this.BlockSizeY); valuemap.SetIf("CtrlAsInput", this.CtrlAsInput); valuemap.SetIf("DynamicsOff", this.DynamicsOff); valuemap.SetIf("EnableGrid", this.EnableGrid); valuemap.SetIf("LineAdjustFrom", this.LineAdjustFrom); valuemap.SetIf("LineAdjustTo", this.LineAdjustTo); valuemap.SetIf("LineJumpCode", this.LineJumpCode); valuemap.SetIf("LineJumpFactorX", this.LineJumpFactorX); valuemap.SetIf("LineJumpFactorY", this.LineJumpFactorY); valuemap.SetIf("LineJumpStyle", this.LineJumpStyle); valuemap.SetIf("LineRouteExt", this.LineRouteExt); valuemap.SetIf("LineToLineX", this.LineToLineX); valuemap.SetIf("LineToLineY", this.LineToLineY); valuemap.SetIf("LineToNodeX", this.LineToNodeX); valuemap.SetIf("LineToNodeY", this.LineToNodeY); valuemap.SetIf("PageLineJumpDirX", this.PageLineJumpDirX); valuemap.SetIf("PageLineJumpDirY", this.PageLineJumpDirY); valuemap.SetIf("PageShapeSplit", this.PageShapeSplit); valuemap.SetIf("PlaceDepth", this.PlaceDepth); valuemap.SetIf("PlaceFlip", this.PlaceFlip); valuemap.SetIf("PlaceStyle", this.PlaceStyle); valuemap.SetIf("PlowCode", this.PlowCode); valuemap.SetIf("ResizePage", this.ResizePage); valuemap.SetIf("RouteStyle", this.RouteStyle); valuemap.SetIf("AvoidPageBreaks", this.AvoidPageBreaks); valuemap.SetIf("DrawingResizeType", this.DrawingResizeType); 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()); this.WriteVerbose("Number of Updates per Shape: {0}", update.Count() / 1); using (var undoscope = new VA.Application.UndoScope(this.client.VisioApplication, "SetPageCells")) { this.WriteVerbose("Start Update"); update.Execute(pagesheet); this.WriteVerbose("End Update"); } } }