public IVisio.Document DrawScriptingDocumentation() { this._client.Application.AssertApplicationAvailable(); var formdoc = new VisioAutomation.Models.Documents.Forms.FormDocument(); formdoc.Subject = "VisioAutomation.Scripting Documenation"; formdoc.Title = "VisioAutomation.Scripting Documenation"; formdoc.Creator = ""; formdoc.Company = ""; //docbuilder.BodyParaSpacingAfter = 6.0; var lines = new List <string>(); var cmdst_props = Client.GetProperties().OrderBy(i => i.Name).ToList(); var sb = new System.Text.StringBuilder(); var helpstr = new System.Text.StringBuilder(); foreach (var cmdset_prop in cmdst_props) { var cmdset_type = cmdset_prop.PropertyType; var commands = CommandSet.GetCommands(cmdset_type); lines.Clear(); foreach (var command in commands) { sb.Length = 0; var cmdparams = command.GetParameters(); var cmdparam_strings = cmdparams.Select(p => string.Format("{0} {1}", p.TypeDisplayName, p.Name)); VisioScripting.Helpers.TextHelper.Join(sb, ", ", cmdparam_strings); if (command.ReturnsValue) { string line = string.Format("{0}({1}) -> {2}", command.Name, sb, command.ReturnTypeDisplayName); lines.Add(line); } else { string line = string.Format("{0}({1})", command.Name, sb); lines.Add(line); } } lines.Sort(); helpstr.Length = 0; VisioScripting.Helpers.TextHelper.Join(helpstr, "\r\n", lines); var formpage = new VisioAutomation.Models.Documents.Forms.FormPage(); formpage.Title = cmdset_prop.Name + " commands"; formpage.Body = helpstr.ToString(); formpage.Name = cmdset_prop.Name + " commands"; formpage.Size = new VisioAutomation.Geometry.Size(8.5, 11); formpage.PageMargin = new PageMargin(0.5, 0.5, 0.5, 0.5); formdoc.Pages.Add(formpage); } //hide_ui_stuff(docbuilder.VisioDocument); var app = this._client.Application.Get(); var doc = formdoc.Render(app); return(doc); }
public IVisio.Document DrawInteropEnumDocumentation() { this._client.Application.AssertApplicationAvailable(); var formdoc = new VisioAutomation.Models.Documents.Forms.FormDocument(); var helpstr = new System.Text.StringBuilder(); int chunksize = 70; var interop_enums = VisioScripting.Helpers.InteropHelper.GetEnums(); foreach (var enum_ in interop_enums) { int chunkcount = 0; var values = enum_.Values.OrderBy(i => i.Name).ToList(); foreach (var chunk in DeveloperCommands.Chunk(values, chunksize)) { helpstr.Length = 0; foreach (var val in chunk) { helpstr.AppendFormat("0x{0}\t{1}\n", val.Value.ToString("x"), val.Name); } var formpage = new VisioAutomation.Models.Documents.Forms.FormPage(); formpage.Size = new VisioAutomation.Geometry.Size(8.5, 11); formpage.PageMargin = new PageMargin(0.5, 0.5, 0.5, 0.5); formpage.Title = enum_.Name; formpage.Body = helpstr.ToString(); if (chunkcount == 0) { formpage.Name = string.Format("{0}", enum_.Name); } else { formpage.Name = string.Format("{0} ({1})", enum_.Name, chunkcount + 1); } //docbuilder.BodyParaSpacingAfter = 2.0; formpage.BodyTextSize = 8.0; formdoc.Pages.Add(formpage); var tabstops = new[] { new VisioAutomation.Text.TabStop(1.5, VisioAutomation.Text.TabStopAlignment.Left) }; //VA.Text.TextFormat.SetTabStops(docpage.VisioBodyShape, tabstops); chunkcount++; } } formdoc.Subject = "Visio Interop Enum Documenation"; formdoc.Title = "Visio Interop Enum Documenation"; formdoc.Creator = ""; formdoc.Company = ""; //hide_ui_stuff(docbuilder.VisioDocument); var application = this._client.Application.Get(); var doc = formdoc.Render(application); return(doc); }