Diagram

Diagram class

Root element of Visio objects hierarchy.

Constructors

NameDescription
Diagram
DiagramPublic class constructor, loads the diagram from the file.
DiagramPublic class constructor, loads the diagram from the file using predefined format.
DiagramPublic class constructor, loads the diagram from the file using predefined load file options.

Properties

NameTypeDescription
StartlongIndicates whether the document has been modified outside of Visio. If present, Visio will fully test the contents of the
FontDirsString[]Indicates the Fonts folder path
KeyStringIndicates whether the document has been modified outside of Visio. If present, Visio will fully test the contents of the
MetricintWhether to use metric units in the drawing. Set this attribute to True (1) to use metric units; set it to False (0) to u
BuildnumlongThe build number of the Visio instance used to create the document.
VersionStringThe version number of the Visio instance. Microsoft Visio 2010 = 14.
DocLangIDintThe unique ID of the user-interface language the user has specified in Microsoft Office 2010 Language Preferences.
StyleSheetsStyleSheetCollectionCollection StyleSheet objects.
MastersMasterCollectionCollection Master objects.
PagesPageCollectionCollection Page objects.
DocumentPropsDocumentPropertiesContains document property elements such as the document’s title, author, and so on.
DocumentSettingsDocumentSettingsContains elements that specify document settings.
ColorsColorEntryCollectionContains the document’s color table. Each document contains a single color table, which lists the 24 standard colors tha
FontsFontCollectionContains a collection of Font elements
DocumentSheetDocumentSheetSpecifies a document’s ShapeSheet structure.
ActivePagePageSpecifies the active page
WindowsWindowCollectionContains the Window elements for a document.
EventItemsEventItemCollectionContains an EventItem element for each event to which an object should respond.
HeaderFooterHeaderFooterContains elements for a document’s header and footer.
VbProjectDatabyte[]Contains the Microsoft Visual Basic for Applications project data in MIME (Multipurpose Internet Mail Extensions) encode
EmailRoutingDatabyte[]Contains a MIME (Multipurpose Internet Mail Extensions) encoded MAPI e-mail routing slip for the document.
DataConnectionsDataConnectionCollectionContains the DataConnection elements for the document.
DataRecordSetsDataRecordSetCollectionThe collection of DataRecordset objects associated with a Document object.
RibbonXStringThe Ribbon XML string that is passed to the document to customize the ribbon user interface.
UserCustomUIStringThe Ribbon XML string that is passed to the document to customize the Quick Access toolbar or the ribbon.
ValidationValidationStores information about diagram validation for the document.
SolutionXMLsSolutionXMLCollectionXML value.
VbaProjectVbaProjectGets the VbaProject VbaProject .
InterruptMonitorAbstractInterruptMonitorGets and sets the interrupt monitor.

Methods

NameDescription
saveSaves the diagram data to the file.
disposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
copyThemeCopies Theme from a source Diagram.
combineCombines another Diagram object.
addMasterAdds master to diagram from source diagram by master’s Name or NameU.
hasHiddenInfoIndicates whether this diagram has hidden information.
removeHiddenInformationRemove unused information
getUnusedStylesGet unused Styles
addShapeAdds shape created by master to specific page.
printPrint the whole document to the specified printer,using the standard (no User Interface) print controller.

If printerNa | | getDefaultFontDir | Get the Default Fonts folder path | | removeMacro | Removes VBA/macro from this diagram. |

Diagram() (1 of 4)


Diagram(filename) (2 of 4)

Public class constructor, loads the diagram from the file.

ParameterTypeDescription
filenameStringThe file name.

Diagram(filename, format) (3 of 4)

Public class constructor, loads the diagram from the file using predefined format.

ParameterTypeDescription
filenameStringThe file name.
formatintA LoadFileFormat value. The file format.

Diagram(filename, options) (4 of 4)

Public class constructor, loads the diagram from the file using predefined load file options.

ParameterTypeDescription
filenameStringThe file name.
optionsLoadOptionsThe data LoadOptions .

Diagram.Start property

Indicates whether the document has been modified outside of Visio. If present, Visio will fully test the contents of the file. Omit for files you create outside of Visio.

Type: long

Diagram.FontDirs property

Indicates the Fonts folder path

Type: String[]

Diagram.Key property

Indicates whether the document has been modified outside of Visio. If present, Visio will fully test the contents of the file. Omit for files you create outside of Visio.

Type: String

Diagram.Metric property

Whether to use metric units in the drawing. Set this attribute to True (1) to use metric units; set it to False (0) to use English units. The value of the property is BOOL integer constant.

Type: int

Diagram.Buildnum property

The build number of the Visio instance used to create the document.

Type: long

Diagram.Version property

The version number of the Visio instance. Microsoft Visio 2010 = 14.

Type: String

Diagram.DocLangID property

The unique ID of the user-interface language the user has specified in Microsoft Office 2010 Language Preferences.

Type: int

Diagram.StyleSheets property

Collection StyleSheet objects.

Type: StyleSheetCollection

Diagram.Masters property

Collection Master objects.

Type: MasterCollection

Diagram.Pages property

Collection Page objects.

Type: PageCollection

Diagram.DocumentProps property

Contains document property elements such as the document’s title, author, and so on.

Type: DocumentProperties

Diagram.DocumentSettings property

Contains elements that specify document settings.

Type: DocumentSettings

Diagram.Colors property

Contains the document’s color table. Each document contains a single color table, which lists the 24 standard colors that are available for application to objects such as shapes, text, and layers in the document.

Type: ColorEntryCollection

Diagram.Fonts property

Contains a collection of Font elements

Type: FontCollection

Diagram.DocumentSheet property

Specifies a document’s ShapeSheet structure.

Type: DocumentSheet

Diagram.ActivePage property

Specifies the active page

Type: Page

Diagram.Windows property

Contains the Window elements for a document.

Type: WindowCollection

Diagram.EventItems property

Contains an EventItem element for each event to which an object should respond.

Type: EventItemCollection

Diagram.HeaderFooter property

Contains elements for a document’s header and footer.

Type: HeaderFooter

Diagram.VbProjectData property

Contains the Microsoft Visual Basic for Applications project data in MIME (Multipurpose Internet Mail Extensions) encoded format.

Type: byte[]

Diagram.EmailRoutingData property

Contains a MIME (Multipurpose Internet Mail Extensions) encoded MAPI e-mail routing slip for the document.

Type: byte[]

Diagram.DataConnections property

Contains the DataConnection elements for the document.

Type: DataConnectionCollection

Diagram.DataRecordSets property

The collection of DataRecordset objects associated with a Document object.

Type: DataRecordSetCollection

Diagram.RibbonX property

The Ribbon XML string that is passed to the document to customize the ribbon user interface.

Type: String

Diagram.UserCustomUI property

The Ribbon XML string that is passed to the document to customize the Quick Access toolbar or the ribbon.

Type: String

Diagram.Validation property

Stores information about diagram validation for the document.

Type: Validation

Diagram.SolutionXMLs property

XML value.

Type: SolutionXMLCollection

Diagram.VbaProject property

Gets the VbaProject VbaProject .

Type: VbaProject

Diagram.InterruptMonitor property

Gets and sets the interrupt monitor.

Type: AbstractInterruptMonitor

save(filename, format)

Saves the diagram data to the file.

ParameterTypeDescription
filenameStringThe file name.
formatintA SaveFileFormat value. SaveFileFormat save file format.

dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

copyTheme(source)

Copies Theme from a source Diagram.

ParameterTypeDescription
sourceDiagramsource diagram.

combine(secondDiagram)

Combines another Diagram object.

ParameterTypeDescription
secondDiagramDiagramAnother Diagram object.

addMaster(srcDiagram, masterName) (1 of 3)

Adds master to diagram from source diagram by master’s Name or NameU.

ParameterTypeDescription
srcDiagramDiagramsource diagram.
masterNameStringMaster’s Name or NameU.

Returns: The unique ID of the master within masters collection in this diagram.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

diagram = new aspose.diagram.Diagram();
templateFileName = "NetApp-FAS-series.vss";

// Add master with stencil file path and master id
masterName = "FAS80xx rear empty";
diagram.addMaster(templateFileName, 2);

// Add master with stencil file path and master name
diagram.addMaster(templateFileName, masterName);

// adds master to diagram from source diagram
src = new aspose.diagram.Diagram(templateFileName);
diagram.addMaster(src, masterName);

// Adds shape with defined PinX and PinY.
diagram.addShape(2.0, 2.0, masterName, 0);
diagram.addShape(6.0, 6.0, masterName, 0);

// Adds shape with defined PinX,PinY,Width and Height.
diagram.addShape(7.0, 3.0, 1.5, 1.5, masterName, 0);

// Save resultant Image file
diagram.save("out-AddMasterFromStencil.vsdx", aspose.diagram.SaveFileFormat.VSDX);

addMaster(templateFilePath, masterName) (2 of 3)

Adds master to diagram from template file by master’s Name or NameU.

ParameterTypeDescription
templateFilePathStringPath to template file(can be vdx, vst or vsd format).
masterNameStringMaster’s Name or NameU.

Returns: The unique ID of the master within masters collection in this diagram.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

diagram = new aspose.diagram.Diagram();
templateFileName = "NetApp-FAS-series.vss";

// Add master with stencil file path and master id
masterName = "FAS80xx rear empty";
diagram.addMaster(templateFileName, 2);

// Add master with stencil file path and master name
diagram.addMaster(templateFileName, masterName);

// adds master to diagram from source diagram
src = new aspose.diagram.Diagram(templateFileName);
diagram.addMaster(src, masterName);

// Adds shape with defined PinX and PinY.
diagram.addShape(2.0, 2.0, masterName, 0);
diagram.addShape(6.0, 6.0, masterName, 0);

// Adds shape with defined PinX,PinY,Width and Height.
diagram.addShape(7.0, 3.0, 1.5, 1.5, masterName, 0);

// Save resultant Image file
diagram.save("out-AddMasterFromStencil.vsdx", aspose.diagram.SaveFileFormat.VSDX);

addMaster(templateFilePath, masterID) (3 of 3)

Adds master to diagram from template file by master’s ID.

ParameterTypeDescription
templateFilePathStringPath to template file(can be vdx, vst or vsd format).
masterIDintThe unique ID of the master within masters collection in template.

Returns: The unique ID of the master within masters collection in this diagram.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

diagram = new aspose.diagram.Diagram();
templateFileName = "NetApp-FAS-series.vss";

// Add master with stencil file path and master id
masterName = "FAS80xx rear empty";
diagram.addMaster(templateFileName, 2);

// Add master with stencil file path and master name
diagram.addMaster(templateFileName, masterName);

// adds master to diagram from source diagram
src = new aspose.diagram.Diagram(templateFileName);
diagram.addMaster(src, masterName);

// Adds shape with defined PinX and PinY.
diagram.addShape(2.0, 2.0, masterName, 0);
diagram.addShape(6.0, 6.0, masterName, 0);

// Adds shape with defined PinX,PinY,Width and Height.
diagram.addShape(7.0, 3.0, 1.5, 1.5, masterName, 0);

// Save resultant Image file
diagram.save("out-AddMasterFromStencil.vsdx", aspose.diagram.SaveFileFormat.VSDX);

hasHiddenInfo()

Indicates whether this diagram has hidden information.

removeHiddenInformation(item)

Remove unused information

ParameterTypeDescription
itemintRemoveHiddenInfoItem.

getUnusedStyles()

Get unused Styles

addShape(newShape, masterName, pageNumber) (1 of 3)

Adds shape created by master to specific page.

ParameterTypeDescription
newShapeShapeNew shape object Shape .
masterNameStringMaster’s name.
pageNumberintIndex of page.

Returns: The unique ID of the shape within shapes collection on the specified page.


addShape(pinX, pinY, masterName, pageNumber) (2 of 3)

Adds shape created by master on page with defined PinX and PinY.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the shape’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the shape’s pin (center of rotation) in relation to the page.
masterNameStringMaster’s name.
pageNumberintIndex of page.

Returns: The unique ID of the shape within shapes collection on the specified page.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

diagram = new aspose.diagram.Diagram();
templateFileName = "NetApp-FAS-series.vss";

// Add master with stencil file path and master id
masterName = "FAS80xx rear empty";
diagram.addMaster(templateFileName, 2);

// Add master with stencil file path and master name
diagram.addMaster(templateFileName, masterName);

// adds master to diagram from source diagram
src = new aspose.diagram.Diagram(templateFileName);
diagram.addMaster(src, masterName);

// Adds shape with defined PinX and PinY.
diagram.addShape(2.0, 2.0, masterName, 0);
diagram.addShape(6.0, 6.0, masterName, 0);

// Adds shape with defined PinX,PinY,Width and Height.
diagram.addShape(7.0, 3.0, 1.5, 1.5, masterName, 0);

// Save resultant Image file
diagram.save("out-AddMasterFromStencil.vsdx", aspose.diagram.SaveFileFormat.VSDX);

addShape(pinX, pinY, width, height, masterName, pageNumber) (3 of 3)

Adds shape created by master on page with defined PinX,PinY,Width and Height.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the shape’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the shape’s pin (center of rotation) in relation to the page.
widthfloatSpecifies the width of the shape in inches.
heightfloatSpecifies the height of the shape in inches.
masterNameStringMaster’s name.
pageNumberintIndex of page.

Returns: The unique ID of the shape within shapes collection on the specified page.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

diagram = new aspose.diagram.Diagram();
templateFileName = "NetApp-FAS-series.vss";

// Add master with stencil file path and master id
masterName = "FAS80xx rear empty";
diagram.addMaster(templateFileName, 2);

// Add master with stencil file path and master name
diagram.addMaster(templateFileName, masterName);

// adds master to diagram from source diagram
src = new aspose.diagram.Diagram(templateFileName);
diagram.addMaster(src, masterName);

// Adds shape with defined PinX and PinY.
diagram.addShape(2.0, 2.0, masterName, 0);
diagram.addShape(6.0, 6.0, masterName, 0);

// Adds shape with defined PinX,PinY,Width and Height.
diagram.addShape(7.0, 3.0, 1.5, 1.5, masterName, 0);

// Save resultant Image file
diagram.save("out-AddMasterFromStencil.vsdx", aspose.diagram.SaveFileFormat.VSDX);

print(printerName) (1 of 2)

Print the whole document to the specified printer,using the standard (no User Interface) print controller.

If printerName is Null or empty will be used default printer.

ParameterTypeDescription
printerNameStringThe name of the printer.Can be Null

Prints the document,using the standard (no User Interface) print controller and a document name.

ParameterTypeDescription
printerNameStringThe name of the printer.Can be Null
documentNameStringThe document name to display (for example, in a print status dialog box or printer queue) while printing the document.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

diagram = new aspose.diagram.Diagram("Pages.vsdx");

// call the print method to print whole Diagram using the printer name
// and set document name in the print job
diagram.print("Microsoft Print to PDF", "Job name while printing with Aspose.Diagram");

getDefaultFontDir()

Get the Default Fonts folder path

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

diagram = new aspose.diagram.Diagram("RetrieveFontInfo.vsd");
console.log(diagram.getDefaultFontDir());

removeMacro()

Removes VBA/macro from this diagram.