Add a color to the document-level color palette and return its integer index (IX).
If the color is already registered the existing index is returned without creating a duplicate. The two built-in colors are always present:
#000000 (black)#FFFFFF (white)User colors receive indices starting at 2.
CSS hex string — '#4472C4', '#ABC', or '4472c4' are all accepted.
Integer IX that uniquely identifies this color in the palette.
Define a new master shape in the document and return its record.
Creates all necessary OPC infrastructure (masters.xml, content-type
overrides, and document-level relationships) on the first call.
Display name shown in the stencil panel.
Visual outline; defaults to 'rectangle'.
Create a named document-level stylesheet and return its record.
The returned id can be passed to addShape({ styleId }) or shape.applyStyle().
Delete a page from the document. Removes the page XML, its relationships, the Content Types entry, and any BackPage references from other pages.
Return all color entries in the document palette, ordered by index.
Return all master shapes currently defined in the document.
Each record's id can be passed as masterId to page.addShape().
Read document metadata from docProps/core.xml and docProps/app.xml.
Fields not present in the file are returned as undefined.
Find a page by name. Returns undefined if no page with that name exists.
Return all stylesheets defined in the document (including built-in styles).
Import all masters from a .vssx stencil file into this document.
Each master is assigned a fresh ID that does not conflict with any
master already present. Returns the array of imported master records.
Filesystem path or raw buffer of the .vssx file.
Move a page to a new 0-based position in the tab order.
Clamps toIndex to the valid range automatically.
Rename a page. Updates page.name in-memory as well as the pages.xml record.
Optionalfilename: stringWrite document metadata. Only the supplied fields are changed; all other fields keep their existing values.
StaticcreateStaticload
The root object for reading and writing Visio (
.vsdx) files.Create a blank document with VisioDocument.create or load an existing file with VisioDocument.load. Call VisioDocument.save when done.
Example