Customization
The VSDX Export has two entry classes: VsdxExport and VsdxIO. The VsdxExport class provides a simple API, that exports a single diagram on a single VSDX page in a single method call. The API of VsdxIO is more flexible and powerful. It allows to control the exact diagram position, to render multiple diagrams into a single VSDX file, to add diagrams to existing VSDX files, and to programmatically add other content. The following code snippet will produce the same VSDX file using VsdxExport in one case and VsdxIO in the other:
// create the VSDX file with VsdxExport
new VsdxExport()
.writeBlob(graphComponent)
.then(blob => saveBlob(blob))
// create the VSDX file with VsdxIO
const vsdxIO = VsdxIO.createDefault()
vsdxIO
.addGraph(graphComponent)
.then(() => vsdxIO.writeBlob())
.then(blob => saveBlob(blob))Usually, the VSDX Export’s default configuration is all you need to create pleasing VSDX files. However, sometimes, the automatic conversion of yFiles styles does not work out of the box. For such cases the VSDX Export provides different ways to customize the output. One way is to employ existing VSSX stencil files and apply its masters and styles to the graph items.