Skip to main content

VisioDocument

The top-level model in the Visio archive structure, containing all the project file data.

VisioDocument is a starting point for both importing a Visio vsdx project, as well as exporting a JointJS project to a vsdx file. When importing a vsdx project, VisioDocument is used to navigate pages, page contents, master shapes etc. In export process, VisioDocument is helpful in instantiating VisioShapes based on VisioMaster shapes and finally building a vsdx file from the document contents.

Methods

getMasters()

visioDocument.getMasters(): VisioMaster[];

Return an array of VisioMaster instances present in the document.

getMastersIdMap()

visioDocument.getMastersMameMap(): { [id: number]: VisioMaster };

Return a Map of VisioMaster instances present in the document, using master id as the key.

getMastersIdMap()

visioDocument.getMastersMameMap(): { [name: string]: VisioMaster };

Return a Map of VisioMaster instances present in the document, using master name as the key.

getPage()

visioDocument.getPage(id: number): VisioPage;

Return a VisioPage metadata object describing a single page with the given pageId. If page with given id doesn't exist, method will return undefined.

Metadata does not contain page contents. To load contents, use page.getContent() method.

pageId

A unique integer page id number.

To fetch metadata of a particular page do:

const archive = await VisioArchive.fromURL('./assets/vsdx/archive.vsdx');
const { document: vsdDocument } = archive;

const page1 = vsdDocument.getPage(0);

To fetch a page that's used as a background for a particular page, simply do:

const archive = await VisioArchive.fromURL('./assets/vsdx/archive.vsdx');
const { document: vsdDocument } = archive;

const page1 = vsdDocument.getPage(0);
const bgPage = vsdDocument.getPage(page1.backPage);

getPages()

visioDocument.getPages(): VisioPage[];

Return an array of VisioPage metadata objects present in the loaded vsdx document. Metadata does not contain page contents. To load contents of a particular page, use page.getContent() method.

getPages() can be useful i.e. for building project page listing.

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub