Microsoft® Visio File Splitting via Python

Split single Visio document into different files using Python code within Python based applications

 

Python Visio Library is capable to split Visio document into multiple pages within Python based applications. Supported file formats include VDW, VDX, VSD, VSDM, VSDX, VSS, VSSM,VSSX,VST,VSTM,VSTX,VSX,VTX.

Split Visio Document into Multiple Files

The simplest way to split Visio files page wise is, Accessing all pages via [pages], Iterating through each page and calling the [Copy] method. Finally saving it into a specified path.

  • Load the Visio file with full path using [diagram class].
  • Iterate throug each page
  • Create a new Diagram class object
  • Copy the page via [Copy method]
  • Call the save() method and pass the file name (full path) having relevant SaveFormat.
Python Code to Split Visio Files

diagram = Diagram( "file.vsdx");
page = diagram.getPages().get(0);
dia =  Diagram();
dia.getPages().get(0).copy(page);
dia.save("outpath_with_filename", Aspose.Diagram.SaveFileFormat.VSDX);