Visio Diagrams with Python: Resize to fit

Resize Page to Fit Contents, Set Zoom to Fit Page

When the drawing is ready, the size of the page will be too large or too small – „fit to contents“ might be the solution.

Additionally, I prefer the Zoom of the active Window to be set that it shows the whole drawing.

page.ResizeToFitContents()      #https://docs.microsoft.com/de-de/office/vba/api/visio.page.resizetofitcontents
window = visio.ActiveWindow     #https://docs.microsoft.com/de-de/office/vba/api/visio.application.activewindow
window.ViewFit=1                #https://docs.microsoft.com/de-de/office/vba/api/visio.window.viewfit

Result

Schreibe einen Kommentar