aspose.diagram
Class Diagram

Root element of Visio objects hierarchy.

Example:

The following example creates a diagram from a file and saves it to another file.
//Use Aspose.Diagram for Node.js via Java
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

var diagram = new aspose.diagram.Diagram("example.vsdx");
diagram.save("output.vsdx", aspose.diagram.SaveFileFormat.VSDX);

Constructor Summary
Diagram()
          
Diagram(filename)
           Public class constructor, loads the diagram from the file.
Diagram(filename, format)
           Public class constructor, loads the diagram from the file using predefined format.
Diagram(filename, options)
           Public class constructor, loads the diagram from the file using predefined load file options.
 
Property Getters/Setters Summary
functiongetBuildnum()
functionsetBuildnum(value)
           The build number of the Visio instance used to create the document.
functiongetColors()
           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.
functiongetDataConnections()
           Contains the DataConnection elements for the document.
functiongetDataRecordSets()
           The collection of DataRecordset objects associated with a Document object.
functiongetDocLangID()
functionsetDocLangID(value)
           The unique ID of the user-interface language the user has specified in Microsoft Office 2010 Language Preferences.
functiongetDocumentProps()
           Contains document property elements such as the document's title, author, and so on.
functiongetDocumentSettings()
           Contains elements that specify document settings.
functiongetDocumentSheet()
           Specifies a document's ShapeSheet structure.
functiongetEmailRoutingData()
functionsetEmailRoutingData(value)
           Contains a MIME (Multipurpose Internet Mail Extensions) encoded MAPI e-mail routing slip for the document.
functiongetEventItems()
           Contains an EventItem element for each event to which an object should respond.
functionsetFontDirs(value)
           Indicates the Fonts folder path
functiongetFonts()
           Contains a collection of Font elements
functiongetHeaderFooter()
           Contains elements for a document's header and footer.
functiongetKey()
functionsetKey(value)
           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.
functiongetMasters()
           Collection Master objects.
functiongetMetric()
functionsetMetric(value)
           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.
functiongetPages()
           Collection Page objects.
functiongetRibbonX()
functionsetRibbonX(value)
           The Ribbon XML string that is passed to the document to customize the ribbon user interface.
functiongetSolutionXMLs()
           XML value.
functiongetStart()
functionsetStart(value)
           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.
functiongetStyleSheets()
           Collection StyleSheet objects.
functiongetUserCustomUI()
functionsetUserCustomUI(value)
           The Ribbon XML string that is passed to the document to customize the Quick Access toolbar or the ribbon.
functiongetValidation()
           Stores information about diagram validation for the document.
functiongetVbaProject()
           Gets the VbaProjectVbaProject.
functiongetVbProjectData()
functionsetVbProjectData(value)
           Contains the Microsoft Visual Basic for Applications project data in MIME (Multipurpose Internet Mail Extensions) encoded format.
functiongetVersion()
functionsetVersion(value)
           The version number of the Visio instance. Microsoft Visio 2010 = 14.
functiongetWindows()
           Contains the Window elements for a document.
 
Method Summary
functionaddMaster(srcDiagram, masterName)
           Adds master to diagram from source diagram by master's Name or NameU.
functionaddMaster(templateFilePath, masterID)
           Adds master to diagram from template file by master's ID.
functionaddMaster(templateFilePath, masterName)
           Adds master to diagram from template file by master's Name or NameU.
functionaddShape(newShape, masterName, pageNumber)
           Adds shape created by master to specific page.
functionaddShape(pinX, pinY, width, height, masterName, pageNumber)
           Adds shape created by master on page with defined PinX,PinY,Width and Height.
functionaddShape(pinX, pinY, masterName, pageNumber)
           Adds shape created by master on page with defined PinX and PinY.
functioncombine(secondDiagram)
           Combines another Diagram object.
functioncopyTheme(source)
           Copies Theme from a source Diagram.
static functioncreateDiagramFromStream(stream, callback)
           Public class constructor, loads the diagram from the stream.
static functioncreateDiagramFromStream(stream, options, callback)
           Public class constructor, loads the diagram from the file using predefined load file options.
static functioncreateDiagramFromStream(stream, format, callback)
           Public class constructor, loads the diagram from the stream using predefined format.
functiondispose()
           Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
functiongetDefaultFontDir()
           Get the Default Fonts folder path
functiongetUnusedStyles()
           Get unused Styles
functionhasHiddenInfo()
           Indicates whether this diagram has hidden infomation.
functionlayout(options)
           Lays out the shapes and/or reroutes the connectors for all pages of diagram.
functionprint(printerName)
           Print the whole document to the specified printer,using the standard (no User Interface) print controller.
functionprint(printerName, documentName)
           Prints the document,using the standard (no User Interface) print controller and a document name.
functionremoveHiddenInformation(item)
           Remove unused information
functionremoveMacro()
           Removes VBA/macro from this diagram.
static functionsave(diagram, stream, saveFormat)
           Saves the diagram data to the stream.
static functionsave(diagram, stream, options)
           Saves the diagram to a file using the specified save options.
functionsave(filename, options)
           Saves the document to a file using the specified save options.
functionsave(filename, format)
           Saves the diagram data to the file.
 

Constructor Detail

Diagram

function Diagram()

Diagram

function Diagram(filename)
Public class constructor, loads the diagram from the file.
Parameters:
filename: String - The file name.

Diagram

function Diagram(filename, format)
Public class constructor, loads the diagram from the file using predefined format.
Parameters:
filename: String - The file name.
format: Number - A LoadFileFormat value. The file format.

Diagram

function Diagram(filename, options)
Public class constructor, loads the diagram from the file using predefined load file options.
Parameters:
filename: String - The file name.
options: LoadOptions - The data LoadOptions.

Property Getters/Setters Detail

getStart/setStart : long 

function getStart() / function setStart(value)
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.

setFontDirs : String[] 

function setFontDirs(value)
Indicates the Fonts folder path

Example:

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

var fontDirs = ["C:\\MyFonts\\", "D:\\Misc\\Fonts\\"];
diagram = new aspose.diagram.Diagram("SpecifyFontLocation.vsdx");

// setting the custom font directories
diagram.setFontDirs(fontDirs);
// saving Visio diagram in PDF format
diagram.save("out-SpecifyFontLocation.pdf", aspose.diagram.SaveFileFormat.PDF);

getKey/setKey : String 

function getKey() / function setKey(value)
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.

getMetric/setMetric : Number 

function getMetric() / function setMetric(value)
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.

getBuildnum/setBuildnum : long 

function getBuildnum() / function setBuildnum(value)
The build number of the Visio instance used to create the document.

getVersion/setVersion : String 

function getVersion() / function setVersion(value)
The version number of the Visio instance. Microsoft Visio 2010 = 14.

getDocLangID/setDocLangID : Number 

function getDocLangID() / function setDocLangID(value)
The unique ID of the user-interface language the user has specified in Microsoft Office 2010 Language Preferences.

getStyleSheets : StyleSheetCollection 

function getStyleSheets()
Collection StyleSheet objects.

Example:

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

diagram = new aspose.diagram.Diagram("ApplyCustomStyleSheets.vsd");

sourceShape = null;
// get page by name
page = diagram.getPages().getPage("Flow 1");
// Find the shape that you want to apply style to
for (it = page.getShapes().iterator(); it.hasNext();) {
    shape = it.next();
    if (shape.getName() == "Process") {
        sourceShape = shape;
        break;
    }
}

customStyleSheet = null;
// Find the required style sheet
for (it = diagram.getStyleSheets().iterator(); it.hasNext();) {
    styleSheet = it.next();
    if (styleSheet.getName() == "Callout") {
        customStyleSheet = styleSheet;
        break;
    }
}

if (sourceShape != null && customStyleSheet != null) {
    // Apply text style
    sourceShape.setTextStyle(customStyleSheet);
    // Apply fill style
    sourceShape.setFillStyle(customStyleSheet);
    // Apply line style
    sourceShape.setLineStyle(customStyleSheet);
}

diagram.save("out-ApplyCustomStyleSheets.vdx", aspose.diagram.SaveFileFormat.VDX);

getMasters : MasterCollection 

function getMasters()
Collection Master objects.

getPages : PageCollection 

function getPages()
Collection Page objects.

getDocumentProps : DocumentProperties 

function getDocumentProps()
Contains document property elements such as the document's title, author, and so on.

Example:

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

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

// Display Visio version and document modification time at different stages
console.log("Visio Instance Version : " + diagram.getVersion());
console.log("Full Build Number Created : " + diagram.getDocumentProps().getBuildNumberCreated());
console.log("Full Build Number Edited : " + diagram.getDocumentProps().getBuildNumberEdited());
console.log("Date Created : " + diagram.getDocumentProps().getTimeCreated());
console.log("Date Last Edited : " + diagram.getDocumentProps().getTimeEdited());
console.log("Date Last Printed : " + diagram.getDocumentProps().getTimePrinted());
console.log("Date Last Saved : " + diagram.getDocumentProps().getTimeSaved());

getDocumentSettings : DocumentSettings 

function getDocumentSettings()
Contains elements that specify document settings.

getColors : ColorEntryCollection 

function getColors()
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.

getFonts : FontCollection 

function getFonts()
Contains a collection of Font elements

Example:

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

diagram = new aspose.diagram.Diagram("RetrieveFontInfo.vsd");
fonts = diagram.getFonts();
for (var it = fonts.iterator(); it.hasNext();) {
    font = it.next();
    // Display information about the fonts
    console.log(font.getName());
}

getDocumentSheet : DocumentSheet 

function getDocumentSheet()
Specifies a document's ShapeSheet structure.

getWindows : WindowCollection 

function getWindows()
Contains the Window elements for a document.

Example:

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

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

// iterate through the window elements
for (it = diagram.getWindows().iterator(); it.hasNext();) {
    window = it.next();
    console.log("ID: " + window.getID());
    console.log("Type: " + window.getWindowType());
    console.log("Window height: " + window.getWindowHeight());
    console.log("Window width: " + window.getWindowWidth());
    console.log("Window state: " + window.getWindowState());
}

getEventItems : EventItemCollection 

function getEventItems()
Contains an EventItem element for each event to which an object should respond.

getHeaderFooter : HeaderFooter 

function getHeaderFooter()
Contains elements for a document's header and footer.

getVbProjectData/setVbProjectData : byte[] 

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

Example:

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

diagram = new aspose.diagram.Diagram("Macro.vsdm");
// remove all macros
diagram.setVbProjectData(null);
// save the Visio diagram
diagram.save("out-RemoveMacros.vssm", aspose.diagram.SaveFileFormat.VSSM);

getEmailRoutingData/setEmailRoutingData : byte[] 

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

getDataConnections : DataConnectionCollection 

function getDataConnections()
Contains the DataConnection elements for the document.

getDataRecordSets : DataRecordSetCollection 

function getDataRecordSets()
The collection of DataRecordset objects associated with a Document object.

getRibbonX/setRibbonX : String 

function getRibbonX() / function setRibbonX(value)
The Ribbon XML string that is passed to the document to customize the ribbon user interface.

getUserCustomUI/setUserCustomUI : String 

function getUserCustomUI() / function setUserCustomUI(value)
The Ribbon XML string that is passed to the document to customize the Quick Access toolbar or the ribbon.

getValidation : Validation 

function getValidation()
Stores information about diagram validation for the document.

getSolutionXMLs : SolutionXMLCollection 

function getSolutionXMLs()
XML value.

Example:

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

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

// iterate through SolutionXML elements
for (it = diagram.getSolutionXMLs().iterator(); it.hasNext();) {
    solutionXML = it.next();
    // get name property
    console.log(solutionXML.getName());
    // get xml value
    console.log(solutionXML.getXmlValue());
}

getVbaProject : VbaProject 

function getVbaProject()
Gets the VbaProjectVbaProject.

Method Detail

save

function save(filename, format)
Saves the diagram data to the file.
Parameters:
filename: String - The file name.
format: Number - A SaveFileFormat value. SaveFileFormat save file format.

save

function save(filename, options)
Saves the document to a file using the specified save options.
Parameters:
filename: String - The file name.
options: SaveOptions - SaveOptions save diagram options.

dispose

function dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

copyTheme

function copyTheme(source)
Copies Theme from a source Diagram.
Parameters:
source: Diagram - source diagram.

combine

function combine(secondDiagram)
Combines another Diagram object.
Parameters:
secondDiagram: Diagram - Another Diagram object.

layout

function layout(options)
Lays out the shapes and/or reroutes the connectors for all pages of diagram.
Parameters:
options: LayoutOptions - Using the LayoutOptions to configure options of layout.

addMaster

function addMaster(srcDiagram, masterName)
Adds master to diagram from source diagram by master's Name or NameU.
Parameters:
srcDiagram: Diagram - source diagram.
masterName: String - Master'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

function addMaster(templateFilePath, masterName)
Adds master to diagram from template file by master's Name or NameU.
Parameters:
templateFilePath: String - Path to template file(can be vdx, vst or vsd format).
masterName: String - Master'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

function addMaster(templateFilePath, masterID)
Adds master to diagram from template file by master's ID.
Parameters:
templateFilePath: String - Path to template file(can be vdx, vst or vsd format).
masterID: Number - The 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

function hasHiddenInfo()
Indicates whether this diagram has hidden infomation.

removeHiddenInformation

function removeHiddenInformation(item)
Remove unused information
Parameters:
item: Number - RemoveHiddenInfoItem.

getUnusedStyles

function getUnusedStyles()
Get unused Styles

addShape

function addShape(newShape, masterName, pageNumber)
Adds shape created by master to specific page.
Parameters:
newShape: Shape - New shape objectShape.
masterName: String - Master's name.
pageNumber: Number - Index of page.
Returns:
The unique ID of the shape within shapes collection on the specified page.

addShape

function addShape(pinX, pinY, masterName, pageNumber)
Adds shape created by master on page with defined PinX and PinY.
Parameters:
pinX: Number - Specifies the x-coordinate of the shape's pin (center of rotation) in relation to the page.
pinY: Number - Specifies the y-coordinate of the shape's pin (center of rotation) in relation to the page.
masterName: String - Master's name.
pageNumber: Number - Index 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

function addShape(pinX, pinY, width, height, masterName, pageNumber)
Adds shape created by master on page with defined PinX,PinY,Width and Height.
Parameters:
pinX: Number - Specifies the x-coordinate of the shape's pin (center of rotation) in relation to the page.
pinY: Number - Specifies the y-coordinate of the shape's pin (center of rotation) in relation to the page.
width: Number - Specifies the width of the shape in inches.
height: Number - Specifies the height of the shape in inches.
masterName: String - Master's name.
pageNumber: Number - Index 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

function print(printerName)
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.
Parameters:
printerName: String - The name of the printer.Can be Null

print

function print(printerName, documentName)
Prints the document,using the standard (no User Interface) print controller and a document name.
Parameters:
printerName: String - The name of the printer.Can be Null
documentName: String - The 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

function 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

function removeMacro()
Removes VBA/macro from this diagram.

createDiagramFromStream

static function createDiagramFromStream(stream, callback)
Public class constructor, loads the diagram from the stream.
Parameters:
stream: ReadableStream - The data stream
callback: Callback - The callback function

Example:

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

var readStream = fs.createReadStream("example.vsdx");
aspose.diagram.Diagram.createDiagramFromStream(readStream, function(diagram, err) {
    if (err) {
        console.log("open error");
        return;
    }
    diagram.save("output.vsdx", aspose.diagram.SaveFileFormat.VSDX);
});
				

createDiagramFromStream

static function createDiagramFromStream(stream, format, callback)
Public class constructor, loads the diagram from the stream using predefined format.
Parameters:
stream: ReadableStream - The data stream
format: Number - A LoadFileFormat value.
callback: Callback - The callback function

Example:

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

var readStream = fs.createReadStream("example.vsdx");
aspose.diagram.Diagram.createDiagramFromStream(readStream, aspose.diagram.LoadFileFormat.VSDX, function(diagram, err) {
    if (err) {
        console.log("open error");
        return;
    }
    diagram.save("output.vsdx", aspose.diagram.SaveFileFormat.VSDX);
});
				

createDiagramFromStream

static function createDiagramFromStream(stream, options, callback)
Public class constructor, loads the diagram from the file using predefined load file options.
Parameters:
stream: ReadableStream - The data stream
options: LoadOptions - The data LoadOptions.
callback: Callback - The callback function

Example:

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

var readStream = fs.createReadStream("example.vsdx");
options = new aspose.diagram.LoadOptions(aspose.diagram.LoadFileFormat.VSDX);
aspose.diagram.Diagram.createDiagramFromStream(readStream, options, function(diagram, err) {
    if (err) {
        console.log("open error: " + err);
        return;
    }
    diagram.save("output.vsdx", aspose.diagram.SaveFileFormat.VSDX);
});
				

save

static function save(diagram, stream, saveFormat)
Saves the diagram data to the stream.
Parameters:
diagram: Diagram - The diagram object to save
stream: WritableStream - The stream
saveFormat: Number - A SaveFileFormat value

Example:

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

var diagram = new aspose.diagram.Diagram("example.vsdx");
var writeStream = fs.createWriteStream("output-stream.vsdx");
aspose.diagram.Diagram.saveToStream(diagram, writeStream, aspose.diagram.SaveFileFormat.VSDX);
				

save

static function save(diagram, stream, options)
Saves the diagram to a file using the specified save options.
Parameters:
diagram: Diagram - The diagram object to save
stream: WritableStream - The stream
options: SaveOptions - SaveOptions save diagram options.

Example:

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

var diagram = new aspose.diagram.Diagram("example.vsdx");
var writeStream = fs.createWriteStream("output-stream.vsdx");
var options = new aspose.diagram.DiagramSaveOptions(aspose.diagram.SaveFileFormat.VSDX);
aspose.diagram.Diagram.saveToStream(diagram, writeStream, options);
				

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.