本文整理汇总了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);
}
示例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);
}
}