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()
methodget(index)
 
Method Summary
methodadd(page)
Add the page in the collection.
methodclear()
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.
methoditerator()
Reserved for internal use.
methodremove(page)
Remove the page from the collection.
methodremoveAt(index)
 

    • Property Getters/Setters Detail

      • getCount : int 

        int getCount()
        
    • 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:
      • clear

         clear()
      • removeAt

         removeAt(index)
      • iterator

        Iterator iterator()
        Reserved for internal use.