The Visio Importer makes it possible to use Visio shapes in your Nevron diagrams. It takes as an input a XML serialized Visio stencil (VSX) and imports its shapes in a Nevron library document which you can use with any Nevron diagram.
To import a Visio stencil in a Nevron library document you should do the following actions:
- Add a reference to the Nevron.Diagram.dll assembly to your project
- Add the Nevron.Diagram.Visio namespace to the using (Import for VB) clauses of your code file
- Create an instance of the NVisioImporter class passing a Nevron library document to its constructor
- Call the Import method of the Visio importer to initiate the importing process
Here's a sample source code:
C# |
Copy Code
|
---|---|
NLibraryDocument libraryDocument = new NLibraryDocument(); NVisioImporter visioImporter = new NVisioImporter(libraryDocument); visioImporter.Import("D:\\VisioStencil.vsx"); |
Visual Basic |
Copy Code
|
---|---|
Dim libraryDocument As NLibraryDocument = New NLibraryDocument() Dim visioImporter As NVisioImporter = New NVisioImporter(libraryDocument) visioImporter.Import("D:\\VisioStencil.vsx") |
You can control the way the Visio importer imports Visio shapes using its properties:
- MeasurementUnit - determines the measurement unit the importer should use. By default set to inch (NGraphicsUnit.Inch), because inch is the default measurement unit used in Visio.
- PreserveShapeHierarchy - Controls whether the importer should preserve the shape hierarchy as in the Visio stencil thus creating nested groups or to import all Visio child shapes as custom paths in a composite shape. By default set to false. If you set this property to true the Visio child shapes will be imported as shapes in a group (or groups nested in a group) thus giving you a great level of control over each child shape and making it possible to use inherited styles. But note that this will also lead to higher memory consumption than the import of the Visio child shapes as custom paths in a composite shape.