OfficeIMO

API Reference

Class

VisioDocument

Namespace OfficeIMO.Visio
Assembly OfficeIMO.Visio

Represents a Visio document containing pages.

Inheritance

  • Object
  • VisioDocument

Constructors

Methods

public VisioPage AddPage(String name, Double width = 8.26771653543307, Double height = 11.69291338582677, VisioMeasurementUnit unit = Inches, Nullable<Int32> id = null) #
Returns: VisioPage

Adds a new page to the document.

Parameters

name System.String requiredposition: 0
Name of the page.
width System.Double = 8.26771653543307 optionalposition: 1
Page width.
height System.Double = 11.69291338582677 optionalposition: 2
Page height.
unit OfficeIMO.Visio.VisioMeasurementUnit = Inches optionalposition: 3
Measurement unit for width and height.
id System.Nullable{System.Int32} = null optionalposition: 4
Optional page identifier. If not specified, uses zero-based index.
Create 2 overloads
public static VisioDocument Create(Stream stream) #
Returns: VisioDocument

Creates a new VisioDocument with the given save path.

Parameters

path System.String requiredposition: 0
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 required
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 required
public VisioMaster GetMaster(String nameU) #
Returns: VisioMaster

Gets a registered master by NameU.

Parameters

nameU System.String requiredposition: 0
public Void ImportMasters(String vsdxPath, IEnumerable<String> names = null) #
Returns: Void

Imports 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 requiredposition: 0
names System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 1
public IReadOnlyList<VisioMaster> ImportMastersAndGet(String vsdxPath, IEnumerable<String> names = null) #
Returns: 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 requiredposition: 0
names System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 1
public static IReadOnlyList<MasterInfo> ListMastersIn(String vsdxPath) #
Returns: IReadOnlyList<MasterInfo>

Lists masters available in a given VSDX file (helper that proxies String)).

Parameters

vsdxPath System.String requiredposition: 0
Load 2 overloads
public static VisioDocument Load(Stream stream) #
Returns: VisioDocument

Loads an existing .vsdx file into a VisioDocument.

Parameters

filePath System.String requiredposition: 0
Load(System.IO.Stream stream) #

Loads an existing .vsdx document from a stream.

Parameters

stream System.IO.Stream required
LoadCore(System.String filePath) #

Loads an existing .vsdx file into a VisioDocument.

Parameters

filePath System.String required
Path to the .vsdx file.
RegisterMaster 2 overloads
public VisioMaster RegisterMaster(VisioMaster master) #
Returns: VisioMaster

Registers a master on the document so it can be reused by name.

Parameters

master OfficeIMO.Visio.VisioMaster requiredposition: 0
public VisioMaster RegisterMaster(String nameU, VisioShape shape, String id = null) #
Returns: VisioMaster

Registers a master blueprint under a NameU and returns the registered master.

Parameters

nameU System.String requiredposition: 0
shape OfficeIMO.Visio.VisioShape requiredposition: 1
id System.String = null optionalposition: 2
public Void RequestRecalcOnOpen() #
Returns: Void

Requests Visio to relayout and reroute connectors when the document is opened.

Save 3 overloads
public Void Save() #
Returns: Void

Saves the document to the path specified when created.

public Void Save(Stream stream) #
Returns: Void

Saves the document to a specified file path.

Parameters

filePath System.String requiredposition: 0
Save(System.IO.Stream stream) #

Saves the document to a specified stream.

Parameters

stream System.IO.Stream required
SaveInternalCore 2 overloads
SaveInternalCore(System.String filePath) #

Core save routine that writes the VSdx structure.

Parameters

filePath System.String required
Target path.
SaveInternalCore(System.IO.Stream destination) #

Core save routine that writes the VSDX structure to a stream.

Parameters

destination System.IO.Stream required
Target stream.
public Boolean TryGetMaster(String nameU, out VisioMaster master) #
Returns: Boolean

Attempts to find a registered master by NameU.

Parameters

nameU System.String requiredposition: 0
master OfficeIMO.Visio.VisioMaster@ requiredposition: 1
public Void UseMastersFromTemplate(String vsdxPath) #
Returns: Void

Learns the available master names from a template VSDX and registers generated library equivalents for those names.

Parameters

vsdxPath System.String requiredposition: 0
Path to a VSDX file that contains canonical masters.
public IReadOnlyList<String> Validate() #
Returns: IReadOnlyList<String>

Validates the in-memory document model and returns authoring-time issues.

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) #
Returns: VisioFluentDocument

Wraps the document in a VisioFluentDocument for fluent configuration.

Parameters

doc OfficeIMO.Visio.VisioDocument requiredposition: 0
The document to wrap.