Working with Protection
Set Protection of the Visio Diagram
Protecting diagrams allow users to lock backgrounds, masters (stencils), shapes and styles so that they cannot be edited. This is useful for protecting corporate styles, for example, and ensure a consistent look across a set of diagrams. Developers can achieve this using Aspose.Diagram for Python via Java.
Edit Protection of the Visio Diagram
The getProtectBkgnds, getProtectMasters, getProtectShapes and getProtectStyles methods, exposed by the DocumentSettings class support the BoolValue object. These properties can be used to protect and unprotect Microsoft Visio diagrams.
In Microsoft Visio you protect documents this way:
- Open a diagram in Microsoft Visio.
- Open Drawing Explorer window.
- Right click a diagram and select Protect Document from the menu.
- In the Protect Document window, check or clear options to lock or unlock different diagram elements.
- Click OK.
Please see how we can check or clear options manually.
Use the code below in your application to perform the same tasks – lock and unlock different elements of your diagram – using Aspose.Diagram for Python via Java.
Edit the Visio Shape Protection
Protecting Visio shapes allow users to lock specific aspects of shapes. Aspects of shapes that can be locked through shape protection include width, height, x-position, y-position, rotation and more. Developers can achieve this using Aspose.Diagram for Python via Java.
The getLockAspect(), getLockBegin(), getLockCalcWH(), getLockCrop(), getLockCustProp(), getLockDelete(), getLockEnd(), getLockFormat(), getLockFromGroupFormat(), getLockGroup(), getLockHeight(), getLockMoveX(), getLockMoveY(), getLockRotate(), getLockSelect(), getLockTextEdit(), getLockThemeColors(), getLockThemeEffects(), getLockVtxEdit() and getLockWidth() methods exposed by the Protection class support the BoolValue object. These methods can be used to protect/unprotect shapes.
In Visio, you need to perform following actions to protect any shape:
- Open a diagram in Microsoft Visio.
- Select a shape.
- Select Protection from the Format menu (Visio 2007), or select Protection from the Developer menu (Visio 2010).
- In the Protection window, select or clear options to lock or unlock shape attribute..
- Click OK.
A shape's protection options, as seen in Microsoft Visio
Use the following code in your Java application to do the same thing (lock/unlock any shape attribute) using Aspose.Diagram for Python via Java.