本文整理汇总了C#中Microsoft.Office.Interop.Visio类的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.Visio类的具体用法?C# Microsoft.Office.Interop.Visio怎么用?C# Microsoft.Office.Interop.Visio使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Microsoft.Office.Interop.Visio类属于命名空间,在下文中一共展示了Microsoft.Office.Interop.Visio类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DropManyU
public static short[] DropManyU(
IVisio.Page page,
IList<IVisio.Master> masters,
IEnumerable<VA.Drawing.Point> points)
{
if (masters == null)
{
throw new System.ArgumentNullException("masters");
}
if (masters.Count < 1)
{
return new short[0];
}
if (points == null)
{
throw new System.ArgumentNullException("points");
}
// NOTE: DropMany will fail if you pass in zero items to drop
var masters_obj_array = masters.Cast<object>().ToArray();
var xy_array = VA.Drawing.Point.ToDoubles(points).ToArray();
System.Array outids_sa;
page.DropManyU(masters_obj_array, xy_array, out outids_sa);
short[] outids = (short[])outids_sa;
return outids;
}
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:31,代码来源:PageHelper.cs
示例2: SRC
public SRC(
IVisio.VisSectionIndices section,
IVisio.VisRowIndices row,
IVisio.VisCellIndices cell)
: this((short)section,(short)row,(short)cell)
{
}
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:7,代码来源:SRC.cs
示例3: Render
public IVisio.Document Render(IVisio.Application app)
{
var docs = app.Documents;
var doc = docs.Add("");
var ctx = new FormRenderingContext(app);
ctx.Application = app;
ctx.Document = doc;
ctx.Pages = doc.Pages;
ctx.Fonts = doc.Fonts;
this.VisioDocument = doc;
doc.Subject = this.Subject;
doc.Title = this.Title;
doc.Creator = this.Creator;
doc.Company = this.Company;
var pages = doc.Pages;
foreach (var formpage in this.Pages)
{
var page = formpage.Draw(ctx);
}
if (pages.Count > 0)
{
// Delete the empty first page
var first_page = VisioDocument.Pages[1];
first_page.Delete(1);
first_page = pages[1];
var active_window = app.ActiveWindow;
active_window.Page = first_page;
}
return doc;
}
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:35,代码来源:FormDocument.cs
示例4: Get
/// <summary>
/// Gets all the user properties defined on a shape
/// </summary>
/// <remarks>
/// If there are no user properties then null will be returned</remarks>
/// <param name="shape"></param>
/// <returns>A list of user properties</returns>
public static IList<UserDefinedCell> Get(IVisio.Shape shape)
{
if (shape == null)
{
throw new System.ArgumentNullException("shape");
}
var prop_count = GetCount(shape);
if (prop_count < 1)
{
return new List<UserDefinedCell>(0);
}
var prop_names = GetNames(shape);
if (prop_names.Count != prop_count)
{
throw new AutomationException("Unexpected number of prop names");
}
var shape_data = UserDefinedCell.GetCells(shape);
var list = new List<UserDefinedCell>(prop_count);
for (int i = 0; i < prop_count; i++)
{
shape_data[i].Name = prop_names[i];
list.Add(shape_data[i]);
}
return list;
}
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:37,代码来源:UserDefinedCellHelper.cs
示例5: PageComparer
public PageComparer(Visio.Application app, Visio.Page page1, Visio.Page page2, Visio.Page resultPage)
{
_page1 = page1;
_page2 = page2;
_resultPage = resultPage;
_app = app;
}
开发者ID:blel,项目名称:Promoveo,代码行数:7,代码来源:PageComparer.cs
示例6: 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("src_page");
}
if (dest_page == null)
{
throw new System.ArgumentNullException("dest_page");
}
if (dest_page == src_page)
{
throw new VA.AutomationException("Destination Page cannot be Source Page");
}
if (src_page != app.ActivePage)
{
throw new VA.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 = VA.Pages.PageCells.GetCells(src_pagesheet);
// handle the dest page
// first update all the page cells
var dest_pagesheet = dest_page.PageSheet;
var update = new VisioAutomation.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:firestream99,项目名称:VisioAutomation,代码行数:60,代码来源:PageHelper.cs
示例7: connect
private void connect(IVisio.Shape a, IVisio.Shape b, bool a_arrow, bool b_arrow)
{
var page = a.ContainingPage;
var connectors_stencil = page.Application.Documents.OpenStencil("connec_u.vss");
var connectors_masters = connectors_stencil.Masters;
var dcm = connectors_masters["Dynamic Connector"];
var drop_point = new VADRAW.Point(-2, -2);
var c1 = page.Drop(dcm, drop_point);
VACONNECT.ConnectorHelper.ConnectShapes(a, b, c1);
//a.AutoConnect(b, connect_dir_none, null);
if (a_arrow || b_arrow)
{
var update = new VASS.Update();
if (a_arrow)
{
update.SetFormula(c1.ID16, VASS.SRCConstants.BeginArrow, "13");
}
if (b_arrow)
{
update.SetFormula(c1.ID16, VASS.SRCConstants.EndArrow, "13");
}
update.Execute(page);
}
}
开发者ID:shekharssorot2002,项目名称:VisioAutomation2.0,代码行数:28,代码来源:PathAnalysis_Tests.cs
示例8: SectionColumn
internal SectionColumn(int ordinal, IVisio.VisSectionIndices section)
{
this.Name = ShapeSheetHelper.GetSectionName(section);
this.Ordinal = ordinal;
this.SectionIndex = section;
this.CellColumns = new CellColumnList();
}
开发者ID:shekharssorot2002,项目名称:VisioAutomation2.0,代码行数:7,代码来源:SectionColumn.cs
示例9: Render
public void Render(IVisio.Page page)
{
var dic = GetDayOfWeekDic();
// calcualte actual days in month
int weekday = 0 + dic[this.MonthYear.FirstDay.DayOfWeek];
int week = 0;
foreach (int day in Enumerable.Range(0,this.MonthYear.DaysInMonth))
{
double x = 0.0 + weekday*1.0;
double y = 6.0 - week*1.0;
var shape = page.DrawRectangle(x, y, x + 0.9, y + 0.9);
weekday++;
if (weekday >= 7)
{
week++;
weekday = 0;
}
shape.Text = string.Format("{0}", new System.DateTime(this.MonthYear.Year, this.MonthYear.Month, day+1));
}
}
开发者ID:modulexcite,项目名称:Visio-Code-Samples,代码行数:25,代码来源:MonthGrid.cs
示例10: Client
public Client(IVisio.Application app, Context context)
{
if (context == null)
{
throw new System.ArgumentNullException();
}
this._context = context;
this.VisioApplication = app;
this.Application = new VA.Scripting.Commands.ApplicationCommands(this);
this.View = new VA.Scripting.Commands.ViewCommands(this);
this.Format = new VA.Scripting.Commands.FormatCommands(this);
this.Layer = new VA.Scripting.Commands.LayerCommands(this);
this.Control = new VA.Scripting.Commands.ControlCommands(this);
this.CustomProp = new VA.Scripting.Commands.CustomPropCommands(this);
this.Export = new VA.Scripting.Commands.ExportCommands(this);
this.Connection = new VA.Scripting.Commands.ConnectionCommands(this);
this.ConnectionPoint = new VA.Scripting.Commands.ConnectionPointCommands(this);
this.Draw = new VA.Scripting.Commands.DrawCommands(this);
this.Master = new VA.Scripting.Commands.MasterCommands(this);
this.Arrange = new VA.Scripting.Commands.ArrangeCommands(this);
this.Page = new VA.Scripting.Commands.PageCommands(this);
this.Selection = new VA.Scripting.Commands.SelectionCommands(this);
this.ShapeSheet = new VA.Scripting.Commands.ShapeSheetCommands(this);
this.Text = new VA.Scripting.Commands.TextCommands(this);
this.UserDefinedCell = new VA.Scripting.Commands.UserDefinedCellCommands(this);
this.Document = new VA.Scripting.Commands.DocumentCommands(this);
this.Developer = new VA.Scripting.Commands.DeveloperCommands(this);
this.Output = new VA.Scripting.Commands.OutputCommands(this);
}
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:30,代码来源:Client.cs
示例11: BuildDiagram
private static void BuildDiagram(Visio.Page page, List<Category> categories, List<Formula> formulae, List<Rule> rules, List<List> lists, List<Lookup> lookups)
{
Console.WriteLine("Drawing {0} categories...", categories.Count);
DrawCategories(page, categories);
Console.WriteLine("Drawing {0} rules...", rules.Count);
DrawRules(page, rules);
var listsToDraw = lists.Where(l => usedListNames.Contains(l.ListName.ToUpperInvariant()));
Console.WriteLine("Drawing {0} lists...", listsToDraw.Count());
DrawLists(page, listsToDraw);
var lookupsToDraw = lookups.Where(l => usedLookupNames.Contains(l.TableName.ToUpperInvariant()));
Console.WriteLine("Drawing {0} lookup tables...", lookupsToDraw.Count());
DrawLookups(page, lookupsToDraw);
var formulaeToDraw = formulae.Where(f => usedFormulaNames.Contains(f.FormulaName.ToUpperInvariant()));
Console.WriteLine("Drawing {0} formulas...", formulaeToDraw.Count());
DrawFormulae(page, formulaeToDraw);
Console.WriteLine("Drawing {0} relations...", relations.Count);
DrawRelations(page);
Console.WriteLine();
Console.WriteLine("Laying out the page...");
page.Layout();
Console.WriteLine("Resizing to fit to contents...");
page.ResizeToFitContents();
}
开发者ID:thijskuipers,项目名称:ExperlogixVisioDiagram,代码行数:30,代码来源:Program.cs
示例12: SectionQuery
internal SectionQuery(CellQuery parent, int ordinal, IVisio.VisSectionIndices section)
{
this.Parent = parent;
this.Ordinal = ordinal;
this.SectionIndex = section;
this.Columns = new ColumnList();
}
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:7,代码来源:CellQuery_SectionQuery.cs
示例13: Connector
public Connector(BaseShape from, BaseShape to, IVisio.Master master)
: base(master,-3,-3)
{
this.Master = new VA.DOM.MasterRef(master);
this.From = from;
this.To = to;
}
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:7,代码来源:Connector.cs
示例14: Set
public static int Set(
IVisio.Shape shape,
short row,
ControlCells ctrl)
{
if (shape == null)
{
throw new ArgumentNullException(nameof(shape));
}
if (!ctrl.XDynamics.Formula.HasValue)
{
ctrl.XDynamics = $"Controls.Row_{row + 1}";
}
if (!ctrl.YDynamics.Formula.HasValue)
{
ctrl.YDynamics = $"Controls.Row_{row + 1}.Y";
}
var update = new ShapeSheet.Update();
update.SetFormulas(ctrl, row);
update.Execute(shape);
return row;
}
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:26,代码来源:ControlHelper.cs
示例15: Field
public Field(IVisio.VisFieldCategories category, IVisio.VisFieldCodes code, IVisio.VisFieldFormats format)
: base(NodeType.Field)
{
this.Category = category;
this.Code = code;
this.Format = format;
}
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:7,代码来源:Field.cs
示例16: Duplicate
public IVisio.Page Duplicate(IVisio.Document dest_doc)
{
this.AssertApplicationAvailable();
this.AssertDocumentAvailable();
if (dest_doc==null)
{
throw new System.ArgumentNullException("dest_doc");
}
var application = this.Client.VisioApplication;
if (application.ActiveDocument == dest_doc)
{
throw new VA.Scripting.ScriptingException("dest doc is same as active doc");
}
var src_page = application.ActivePage;
var dest_pages = dest_doc.Pages;
var dest_page = dest_pages[1];
VA.Pages.PageHelper.Duplicate(src_page, dest_page);
// the active window will be to the new document
var active_window = application.ActiveWindow;
//active_window.Page = dest_page;
return dest_page;
}
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:28,代码来源:PageCommands.cs
示例17: Activate
public static void Activate(IVisio.Document doc)
{
var app = doc.Application;
var cur_active_doc = app.ActiveDocument;
// if the doc is already active do nothing
if (doc == cur_active_doc)
{
// do nothing
return;
}
// go through each window and check if it is assigned
// to the target document
var appwindows = app.Windows;
var allwindows = appwindows.AsEnumerable();
foreach (var curwin in allwindows)
{
if (curwin.Document == doc)
{
// we did find one, so activate that window
// and then exit the method
curwin.Activate();
if (app.ActiveDocument != doc)
{
throw new AutomationException("failed to activate document");
}
return;
}
}
// If we get here, we couldn't find any matching window
throw new VA.AutomationException("could not find window for document");
}
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:34,代码来源:DocumentHelper.cs
示例18: CreateStandardPage
public static IVisio.Page CreateStandardPage(IVisio.Document doc, string pagename)
{
var pages = doc.Pages;
var page = pages.Add();
page.NameU = pagename;
return page;
}
开发者ID:modulexcite,项目名称:Visio-Code-Samples,代码行数:7,代码来源:Util.cs
示例19: Set
public static int Set(
IVisio.Shape shape,
short row,
VACONTROL.ControlCells ctrl)
{
if (shape == null)
{
throw new ArgumentNullException("shape");
}
if (!ctrl.XDynamics.Formula.HasValue)
{
ctrl.XDynamics = String.Format("Controls.Row_{0}", row + 1);
}
if (!ctrl.YDynamics.Formula.HasValue)
{
ctrl.YDynamics = String.Format("Controls.Row_{0}.Y", row + 1);
}
var update = new VA.ShapeSheet.Update();
update.SetFormulas(ctrl, row);
update.Execute(shape);
return row;
}
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:26,代码来源:ControlHelper.cs
示例20: Get
public IList<IVisio.Master> Get(IVisio.Document doc)
{
this.Client.Application.AssertApplicationAvailable();
var doc_masters = doc.Masters;
var masters = doc_masters.AsEnumerable().ToList();
return masters;
}
开发者ID:shekharssorot2002,项目名称:VisioAutomation2.0,代码行数:7,代码来源:MasterCommands.cs
注:本文中的Microsoft.Office.Interop.Visio类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论