当前位置: 首页>>代码示例>>C#>>正文


C# Microsoft.Office.Interop.Visio.Paste方法代码示例

本文整理汇总了C#中Microsoft.Office.Interop.Visio.Paste方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.Visio.Paste方法的具体用法?C# Microsoft.Office.Interop.Visio.Paste怎么用?C# Microsoft.Office.Interop.Visio.Paste使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Office.Interop.Visio的用法示例。


在下文中一共展示了Microsoft.Office.Interop.Visio.Paste方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CopyPage

 /// <summary>
 /// Formats the to Page similar to the from page and 
 /// copies all from FromPage to ToPage
 /// </summary>
 /// <param name="fromPage">Source page</param>
 /// <param name="toPage">Destination page</param>
 private void CopyPage(Visio.Page fromPage, Visio.Page toPage)
 {
     SetupDestinationPage(fromPage, toPage);
     //Copy shapes
     fromPage.AddGuide((short)Visio.VisGuideTypes.visPoint, 0, 0);
     Visio.Selection selection = fromPage.CreateSelection(Visio.VisSelectionTypes.visSelTypeAll);
     selection.Copy();
     toPage.Paste();
     Visio.Selection resultSelection = toPage.CreateSelection(Visio.VisSelectionTypes.visSelTypeAll);
     double origX, origY, newX, newY, dummy1, dummy2;
     selection.BoundingBox(1, out origX, out origY, out dummy1, out dummy2);
     resultSelection.BoundingBox(1, out newX, out newY, out dummy1, out dummy2);
     double diffX = origX - newX;
     double diffY = origY - newY;
     resultSelection.Move(diffX, diffY);
 }
开发者ID:blel,项目名称:Promoveo,代码行数:22,代码来源:DocumentComparer.cs

示例2: Duplicate

        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);                
            }
        }
开发者ID:shekharssorot2002,项目名称:VisioAutomation2.0,代码行数:62,代码来源:PageHelper.cs


注:本文中的Microsoft.Office.Interop.Visio.Paste方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。