Example:
var aspose = aspose || {}; aspose.diagram = require("aspose.diagram"); originalDiagram = new aspose.diagram.Diagram("Pages.vsdx"); // initialize the new visio diagram newDiagram = new aspose.diagram.Diagram(); // add all masters from the source Visio diagram originalMasters = originalDiagram.getMasters(); for (var it = originalMasters.iterator(); it.hasNext();) { master = it.next(); newDiagram.addMaster(originalDiagram, master.getName()); } // get the page object from the original diagram SrcPage = originalDiagram.getPages().getPage("Page-1"); // set page name SrcPage.setName("new page"); // it calculates max page id max = 0; if (newDiagram.getPages().getCount() != 0) { max = newDiagram.getPages().get(0).getID(); } for (i = 1; i < newDiagram.getPages().getCount(); i++) { if (max < newDiagram.getPages().get(i).getID()) { max = newDiagram.getPages().get(i).getID(); } } MaxPageId = max; // set page id SrcPage.setID(MaxPageId); // add reference of the original diagram page newDiagram.getPages().add(SrcPage); // remove first empty page newDiagram.getPages().remove(newDiagram.getPages().get(0)); // save diagram in VDX format newDiagram.save("out-CopyVisioPage.vsdx", aspose.diagram.SaveFileFormat.VSDX);
Property Getters/Setters Summary | ||
---|---|---|
function | getCount() | |
Gets the number of elements actually contained in the collection. | ||
function | get(index) | |
Gets the element at the specified index. |
Method Summary | ||
---|---|---|
function | add(page) | |
Add the page in the collection. | ||
function | clear() | → inherited from Collection |
Removes all elements from collection. | ||
function | dispose() | |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. | ||
function | getPage(ID) | |
Gets the element at the specified ID. | ||
function | getPage(name) | |
Gets the element at the specified name. | ||
function | isExist(index) | → inherited from Collection |
Is exist item in the collection. | ||
function | iterator() | → inherited from Collection |
Supports a simple iteration over a nongeneric collection. | ||
function | remove(page) | |
Remove the page from the collection. |
Property Getters/Setters Detail |
---|
getCount : Number | |
function getCount() |
get : Page | |
function get(index) |
index
- Method Detail |
---|
add | |
function add(page) |
page: Page
- dispose | |
function dispose() |
remove | |
function remove(page) |
page: Page
- getPage | |
function getPage(ID) |
ID: Number
- getPage | |
function getPage(name) |
name: String
- iterator | |
function iterator() |
isExist | |
function isExist(index) |
index: Number
- index of element.clear | |
function clear() |