private static void SetSize(IVisio.Page page, Drawing.Size size)
 {
     var page_cells = new PageCells();
     page_cells.PageHeight = size.Height;
     page_cells.PageWidth = size.Width;
     var pageupdate = new ShapeSheet.Update();
     pageupdate.SetFormulas(page_cells);
     pageupdate.Execute(page.PageSheet);
 }
예제 #2
0
        private static void SetSize(IVisio.Page page, Drawing.Size size)
        {
            var page_cells = new PageCells();

            page_cells.PageHeight = size.Height;
            page_cells.PageWidth  = size.Width;
            var pageupdate = new ShapeSheet.Update();

            pageupdate.SetFormulas(page_cells);
            pageupdate.Execute(page.PageSheet);
        }
예제 #3
0
            public PageCells GetCells(VA.ShapeSheet.CellData <double>[] row)
            {
                var cells = new PageCells();

                cells.PageLeftMargin       = row[PageLeftMargin.Ordinal];
                cells.CenterX              = row[CenterX.Ordinal];
                cells.CenterY              = row[CenterY.Ordinal];
                cells.OnPage               = row[OnPage.Ordinal].ToInt();
                cells.PageBottomMargin     = row[PageBottomMargin.Ordinal];
                cells.PageRightMargin      = row[PageRightMargin.Ordinal];
                cells.PagesX               = row[PagesX.Ordinal];
                cells.PagesY               = row[PagesY.Ordinal];
                cells.PageTopMargin        = row[PageTopMargin.Ordinal];
                cells.PaperKind            = row[PaperKind.Ordinal].ToInt();
                cells.PrintGrid            = row[PrintGrid.Ordinal].ToInt();
                cells.PrintPageOrientation = row[PrintPageOrientation.Ordinal].ToInt();
                cells.ScaleX               = row[ScaleX.Ordinal];
                cells.ScaleY               = row[ScaleY.Ordinal];
                cells.PaperSource          = row[PaperSource.Ordinal].ToInt();
                cells.DrawingScale         = row[DrawingScale.Ordinal];
                cells.DrawingScaleType     = row[DrawingScaleType.Ordinal].ToInt();
                cells.DrawingSizeType      = row[DrawingSizeType.Ordinal].ToInt();
                cells.InhibitSnap          = row[InhibitSnap.Ordinal].ToInt();
                cells.PageHeight           = row[PageHeight.Ordinal];
                cells.PageScale            = row[PageScale.Ordinal];
                cells.PageWidth            = row[PageWidth.Ordinal];
                cells.ShdwObliqueAngle     = row[ShdwObliqueAngle.Ordinal];
                cells.ShdwOffsetX          = row[ShdwOffsetX.Ordinal];
                cells.ShdwOffsetY          = row[ShdwOffsetY.Ordinal];
                cells.ShdwScaleFactor      = row[ShdwScaleFactor.Ordinal];
                cells.ShdwType             = row[ShdwType.Ordinal].ToInt();
                cells.UIVisibility         = row[UIVisibility.Ordinal];
                cells.XGridDensity         = row[XGridDensity.Ordinal];
                cells.XGridOrigin          = row[XGridOrigin.Ordinal];
                cells.XGridSpacing         = row[XGridSpacing.Ordinal];
                cells.XRulerDensity        = row[XRulerDensity.Ordinal];
                cells.XRulerOrigin         = row[XRulerOrigin.Ordinal];
                cells.YGridDensity         = row[YGridDensity.Ordinal];
                cells.YGridOrigin          = row[YGridOrigin.Ordinal];
                cells.YGridSpacing         = row[YGridSpacing.Ordinal];
                cells.YRulerDensity        = row[YRulerDensity.Ordinal];
                cells.YRulerOrigin         = row[YRulerOrigin.Ordinal];
                cells.AvenueSizeX          = row[AvenueSizeX.Ordinal];
                cells.AvenueSizeY          = row[AvenueSizeY.Ordinal];
                cells.BlockSizeX           = row[BlockSizeX.Ordinal];
                cells.BlockSizeY           = row[BlockSizeY.Ordinal];
                cells.CtrlAsInput          = row[CtrlAsInput.Ordinal].ToInt();
                cells.DynamicsOff          = row[DynamicsOff.Ordinal].ToInt();
                cells.EnableGrid           = row[EnableGrid.Ordinal].ToInt();
                cells.LineAdjustFrom       = row[LineAdjustFrom.Ordinal].ToInt();
                cells.LineAdjustTo         = row[LineAdjustTo.Ordinal];
                cells.LineJumpCode         = row[LineJumpCode.Ordinal];
                cells.LineJumpFactorX      = row[LineJumpFactorX.Ordinal];
                cells.LineJumpFactorY      = row[LineJumpFactorY.Ordinal];
                cells.LineJumpStyle        = row[LineJumpStyle.Ordinal].ToInt();
                cells.LineRouteExt         = row[LineRouteExt.Ordinal];
                cells.LineToLineX          = row[LineToLineX.Ordinal];
                cells.LineToLineY          = row[LineToLineY.Ordinal];
                cells.LineToNodeX          = row[LineToNodeX.Ordinal];
                cells.LineToNodeY          = row[LineToNodeY.Ordinal];
                cells.PageLineJumpDirX     = row[PageLineJumpDirX.Ordinal];
                cells.PageLineJumpDirY     = row[PageLineJumpDirY.Ordinal];
                cells.PageShapeSplit       = row[PageShapeSplit.Ordinal].ToInt();
                cells.PlaceDepth           = row[PlaceDepth.Ordinal].ToInt();
                cells.PlaceFlip            = row[PlaceFlip.Ordinal].ToInt();
                cells.PlaceStyle           = row[PlaceStyle.Ordinal].ToInt();
                cells.PlowCode             = row[PlowCode.Ordinal].ToInt();
                cells.ResizePage           = row[ResizePage.Ordinal].ToInt();
                cells.RouteStyle           = row[RouteStyle.Ordinal].ToInt();
                //cells.AvoidPageBreaks = row[AvoidPageBreaks.Ordinal].ToInt();
                //cells.DrawingResizeType = row[DrawingResizeType.Ordinal].ToInt();
                return(cells);
            }
예제 #4
0
        public static void Duplicate(
            IVisio.Page src_page,
            IVisio.Page dest_page)
        {
            var   app = src_page.Application;
            short copy_paste_flags = (short)IVisio.VisCutCopyPasteCodes.visCopyPasteNoTranslate;

            // handle the source page
            if (src_page == null)
            {
                throw new System.ArgumentNullException(nameof(src_page));
            }

            if (dest_page == null)
            {
                throw new System.ArgumentNullException(nameof(dest_page));
            }

            if (dest_page == src_page)
            {
                throw new AutomationException("Destination Page cannot be Source Page");
            }


            if (src_page != app.ActivePage)
            {
                throw new AutomationException("Source page must be active page.");
            }

            var src_page_shapes = src_page.Shapes;
            int num_src_shapes  = src_page_shapes.Count;

            if (num_src_shapes > 0)
            {
                var active_window = app.ActiveWindow;
                active_window.SelectAll();
                var selection = active_window.Selection;
                selection.Copy(copy_paste_flags);
                active_window.DeselectAll();
            }

            var src_pagesheet = src_page.PageSheet;
            var pagecells     = PageCells.GetCells(src_pagesheet);


            // handle the dest page

            // first update all the page cells
            var dest_pagesheet = dest_page.PageSheet;
            var update         = new ShapeSheet.Update();

            update.SetFormulas(pagecells);
            update.Execute(dest_pagesheet);

            // make sure the new page looks like the old page
            dest_page.Background = src_page.Background;

            // then paste any contents from the first page
            if (num_src_shapes > 0)
            {
                dest_page.Paste(copy_paste_flags);
            }
        }
예제 #5
0
 public PageCells GetCells(VA.ShapeSheet.CellData<double>[] row)
 {
     var cells = new PageCells();
     cells.PageLeftMargin = row[PageLeftMargin.Ordinal];
     cells.CenterX = row[CenterX.Ordinal];
     cells.CenterY = row[CenterY.Ordinal];
     cells.OnPage = row[OnPage.Ordinal].ToInt();
     cells.PageBottomMargin = row[PageBottomMargin.Ordinal];
     cells.PageRightMargin = row[PageRightMargin.Ordinal];
     cells.PagesX = row[PagesX.Ordinal];
     cells.PagesY = row[PagesY.Ordinal];
     cells.PageTopMargin = row[PageTopMargin.Ordinal];
     cells.PaperKind = row[PaperKind.Ordinal].ToInt();
     cells.PrintGrid = row[PrintGrid.Ordinal].ToInt();
     cells.PrintPageOrientation = row[PrintPageOrientation.Ordinal].ToInt();
     cells.ScaleX = row[ScaleX.Ordinal];
     cells.ScaleY = row[ScaleY.Ordinal];
     cells.PaperSource = row[PaperSource.Ordinal].ToInt();
     cells.DrawingScale = row[DrawingScale.Ordinal];
     cells.DrawingScaleType = row[DrawingScaleType.Ordinal].ToInt();
     cells.DrawingSizeType = row[DrawingSizeType.Ordinal].ToInt();
     cells.InhibitSnap = row[InhibitSnap.Ordinal].ToInt();
     cells.PageHeight = row[PageHeight.Ordinal];
     cells.PageScale = row[PageScale.Ordinal];
     cells.PageWidth = row[PageWidth.Ordinal];
     cells.ShdwObliqueAngle = row[ShdwObliqueAngle.Ordinal];
     cells.ShdwOffsetX = row[ShdwOffsetX.Ordinal];
     cells.ShdwOffsetY = row[ShdwOffsetY.Ordinal];
     cells.ShdwScaleFactor = row[ShdwScaleFactor.Ordinal];
     cells.ShdwType = row[ShdwType.Ordinal].ToInt();
     cells.UIVisibility = row[UIVisibility.Ordinal];
     cells.XGridDensity = row[XGridDensity.Ordinal];
     cells.XGridOrigin = row[XGridOrigin.Ordinal];
     cells.XGridSpacing = row[XGridSpacing.Ordinal];
     cells.XRulerDensity = row[XRulerDensity.Ordinal];
     cells.XRulerOrigin = row[XRulerOrigin.Ordinal];
     cells.YGridDensity = row[YGridDensity.Ordinal];
     cells.YGridOrigin = row[YGridOrigin.Ordinal];
     cells.YGridSpacing = row[YGridSpacing.Ordinal];
     cells.YRulerDensity = row[YRulerDensity.Ordinal];
     cells.YRulerOrigin = row[YRulerOrigin.Ordinal];
     cells.AvenueSizeX = row[AvenueSizeX.Ordinal];
     cells.AvenueSizeY = row[AvenueSizeY.Ordinal];
     cells.BlockSizeX = row[BlockSizeX.Ordinal];
     cells.BlockSizeY = row[BlockSizeY.Ordinal];
     cells.CtrlAsInput = row[CtrlAsInput.Ordinal].ToInt();
     cells.DynamicsOff = row[DynamicsOff.Ordinal].ToInt();
     cells.EnableGrid = row[EnableGrid.Ordinal].ToInt();
     cells.LineAdjustFrom = row[LineAdjustFrom.Ordinal].ToInt();
     cells.LineAdjustTo = row[LineAdjustTo.Ordinal];
     cells.LineJumpCode = row[LineJumpCode.Ordinal];
     cells.LineJumpFactorX = row[LineJumpFactorX.Ordinal];
     cells.LineJumpFactorY = row[LineJumpFactorY.Ordinal];
     cells.LineJumpStyle = row[LineJumpStyle.Ordinal].ToInt();
     cells.LineRouteExt = row[LineRouteExt.Ordinal];
     cells.LineToLineX = row[LineToLineX.Ordinal];
     cells.LineToLineY = row[LineToLineY.Ordinal];
     cells.LineToNodeX = row[LineToNodeX.Ordinal];
     cells.LineToNodeY = row[LineToNodeY.Ordinal];
     cells.PageLineJumpDirX = row[PageLineJumpDirX.Ordinal];
     cells.PageLineJumpDirY = row[PageLineJumpDirY.Ordinal];
     cells.PageShapeSplit = row[PageShapeSplit.Ordinal].ToInt();
     cells.PlaceDepth = row[PlaceDepth.Ordinal].ToInt();
     cells.PlaceFlip = row[PlaceFlip.Ordinal].ToInt();
     cells.PlaceStyle = row[PlaceStyle.Ordinal].ToInt();
     cells.PlowCode = row[PlowCode.Ordinal].ToInt();
     cells.ResizePage = row[ResizePage.Ordinal].ToInt();
     cells.RouteStyle = row[RouteStyle.Ordinal].ToInt();
     //cells.AvoidPageBreaks = row[AvoidPageBreaks.Ordinal].ToInt();
     //cells.DrawingResizeType = row[DrawingResizeType.Ordinal].ToInt();
     return cells;
 }