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 | ||
---|---|---|
method | getCount() | |
Gets the number of elements actually contained in the collection.
|
||
method | get(index) | |
Gets the element at the specified index.
|
Method Summary | ||
---|---|---|
method | add(page) | |
Add the page in the collection.
|
||
method | clear() | |
Removes all elements from collection.
|
||
method | dispose() | |
Performs application-defined tasks associated with freeing, releasing, or
resetting unmanaged resources.
|
||
method | getPage(ID) | |
Gets the element at the specified ID.
|
||
method | getPage(name) | |
Gets the element at the specified name.
|
||
method | isExist(index) | |
Is exist item in the collection.
|
||
method | iterator() | |
Supports a simple iteration over a nongeneric collection.
|
||
method | remove(page) | |
Remove the page from the collection.
|
int getCount()
int add(page)
page: Page
- dispose()
remove(page)
page: Page
- Page getPage(ID)
ID: int
- Page getPage(name)
name: String
- Iterator iterator()
boolean isExist(index)
index: int
- index of element.clear()