API Reference
VisioDocument
Represents a Visio document containing pages.
Inheritance
- Object
- VisioDocument
Constructors
public VisioDocument() #Methods
public VisioPage AddPage(String name, Double width = 8.26771653543307, Double height = 11.69291338582677, VisioMeasurementUnit unit = Inches, Nullable<Int32> id = null) #VisioPageAdds a new page to the document.
Parameters
- name System.String
- Name of the page.
- width System.Double = 8.26771653543307
- Page width.
- height System.Double = 11.69291338582677
- Page height.
- unit OfficeIMO.Visio.VisioMeasurementUnit = Inches
- Measurement unit for width and height.
- id System.Nullable{System.Int32} = null
- Optional page identifier. If not specified, uses zero-based index.
public static VisioDocument Create(Stream stream) #VisioDocumentCreates a new VisioDocument with the given save path.
Parameters
- path System.String
- Path where the document will be saved.
Create(System.IO.Stream stream) #Creates a new VisioDocument that will be saved to the provided stream.
Parameters
- stream System.IO.Stream
- Destination stream for the VSDX package.
EnsureBuiltinMaster(System.String arg1) #Ensures a built-in master exists for a given NameU (e.g. Rectangle) and returns it. IDs are stable so that generated XML is deterministic and closer to assets.
Parameters
- arg1 System.String
public VisioMaster GetMaster(String nameU) #VisioMasterGets a registered master by NameU.
Parameters
- nameU System.String
public Void ImportMasters(String vsdxPath, IEnumerable<String> names = null) #VoidImports master names from a VSDX file and registers only the library-supported generated equivalents so shapes can reference them by NameU. If names is null or empty, all discoverable supported masters are registered.
Parameters
- vsdxPath System.String
- names System.Collections.Generic.IEnumerable{System.String} = null
public IReadOnlyList<VisioMaster> ImportMastersAndGet(String vsdxPath, IEnumerable<String> names = null) #IReadOnlyList<VisioMaster>Imports master names from a VSDX file and returns the registered generated masters that are natively implemented by the library.
Parameters
- vsdxPath System.String
- names System.Collections.Generic.IEnumerable{System.String} = null
public static IReadOnlyList<MasterInfo> ListMastersIn(String vsdxPath) #IReadOnlyList<MasterInfo>Lists masters available in a given VSDX file (helper that proxies String)).
Parameters
- vsdxPath System.String
LoadCore(System.String filePath) #Loads an existing .vsdx file into a VisioDocument.
Parameters
- filePath System.String
- Path to the .vsdx file.
public VisioMaster RegisterMaster(VisioMaster master) #VisioMasterRegisters a master on the document so it can be reused by name.
Parameters
- master OfficeIMO.Visio.VisioMaster
public VisioMaster RegisterMaster(String nameU, VisioShape shape, String id = null) #VisioMasterRegisters a master blueprint under a NameU and returns the registered master.
Parameters
- nameU System.String
- shape OfficeIMO.Visio.VisioShape
- id System.String = null
public Void RequestRecalcOnOpen() #VoidRequests Visio to relayout and reroute connectors when the document is opened.
public Void Save(Stream stream) #VoidSaves the document to a specified file path.
Parameters
- filePath System.String
Save(System.IO.Stream stream) #Saves the document to a specified stream.
Parameters
- stream System.IO.Stream
public Boolean TryGetMaster(String nameU, out VisioMaster master) #BooleanAttempts to find a registered master by NameU.
Parameters
- nameU System.String
- master OfficeIMO.Visio.VisioMaster@
public Void UseMastersFromTemplate(String vsdxPath) #VoidLearns the available master names from a template VSDX and registers generated library equivalents for those names.
Parameters
- vsdxPath System.String
- Path to a VSDX file that contains canonical masters.
public IReadOnlyList<String> Validate() #IReadOnlyList<String>Validates the in-memory document model and returns authoring-time issues.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public IReadOnlyList<VisioPage> Pages { get; } #Gets the collection of pages in the document.
public IReadOnlyCollection<VisioMaster> Masters { get; } #Gets the masters currently registered on the document, keyed by NameU.
public VisioTheme Theme { get; set; } #Gets or sets the theme applied to the document.
public String Title { get; set; } #Gets or sets the title of the document.
public String Author { get; set; } #Gets or sets the author of the document.
public Boolean UseMastersByDefault { get; set; } #When true, shapes with a known NameU (e.g. "Rectangle") are automatically backed by a document master if none is assigned explicitly. Defaults to false to preserve current library behavior. Set to true to align with native Visio authoring semantics and asset templates.
public Boolean WriteMasterDeltasOnly { get; set; } #When writing page shapes that reference a master, emit only delta cells required for the page instance (e.g., PinX/PinY and minimal style hints) instead of a full XForm block. This better matches Visio-authored files and the provided assets. Defaults to true.
public static IReadOnlyCollection<String> SupportedBuiltinMasters { get; } #Returns the built-in master names that this library can generate natively.
Extension Methods
public static VisioFluentDocument AsFluent(VisioDocument doc) #VisioFluentDocumentWraps the document in a VisioFluentDocument for fluent configuration.
Parameters
- doc OfficeIMO.Visio.VisioDocument
- The document to wrap.