asposediagram.api

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
methodgetCount()
Gets the number of elements actually contained in the collection.
methodget(index)
Gets the element at the specified index.
 
Method Summary
methodadd(page)
Add the page in the collection.
methodclear()
Removes all elements from collection.
methoddispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
methodgetPage(ID)
Gets the element at the specified ID.
methodgetPage(name)
Gets the element at the specified name.
methodisExist(index)
Is exist item in the collection.
methoditerator()
Supports a simple iteration over a nongeneric collection.
methodremove(page)
Remove the page from the collection.
 

    • Property Getters/Setters Detail

      • getCount : int 

        int getCount()
        
        Gets the number of elements actually contained in the collection.
      • get : Page 

        Page get(index)
        
        Gets the element at the specified index.
        Parameters:
        index -
        Returns:
    • Method Detail

      • add

        int add(page)
        Add the page in the collection.
        Parameters:
        page: Page -
        Returns:
      • dispose

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

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

        Page getPage(ID)
        Gets the element at the specified ID.
        Parameters:
        ID: int -
        Returns:
      • getPage

        Page getPage(name)
        Gets the element at the specified name.
        Parameters:
        name: String -
        Returns:
      • iterator

        Iterator iterator()
        Supports a simple iteration over a nongeneric collection.
        Returns:
      • isExist

        boolean isExist(index)
        Is exist item in the collection.
        Parameters:
        index: int - index of element.
        Returns:
      • clear

         clear()
        Removes all elements from collection.