aspose.diagram
Class PageCollection

Page collection.

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
functiongetCount()
           Gets the number of elements actually contained in the collection.
functionget(index)
           Gets the element at the specified index.
 
Method Summary
functionadd(page)
           Add the page in the collection.
functionclear()→ inherited from Collection
           Removes all elements from collection.
functiondispose()
           Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
functiongetPage(ID)
           Gets the element at the specified ID.
functiongetPage(name)
           Gets the element at the specified name.
functionisExist(index)→ inherited from Collection
           Is exist item in the collection.
functioniterator()→ inherited from Collection
           Supports a simple iteration over a nongeneric collection.
functionremove(page)
           Remove the page from the collection.
 

Property Getters/Setters Detail

getCount : Number 

function getCount()
Gets the number of elements actually contained in the collection.

get : Page 

function get(index)
Gets the element at the specified index.
Parameters:
index -
Returns:

Method Detail

add

function add(page)
Add the page in the collection.
Parameters:
page: Page -
Returns:

dispose

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

remove

function remove(page)
Remove the page from the collection.
Parameters:
page: Page -

getPage

function getPage(ID)
Gets the element at the specified ID.
Parameters:
ID: Number -
Returns:

getPage

function getPage(name)
Gets the element at the specified name.
Parameters:
name: String -
Returns:

iterator

function iterator()
Supports a simple iteration over a nongeneric collection.
Returns:

isExist

function isExist(index)
Is exist item in the collection.
Parameters:
index: Number - index of element.
Returns:

clear

function clear()
Removes all elements from collection.

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