Nevron Open Vision Documentation
Diagram / File Formats / Export / Visio Drawing Export
In This Topic
    Visio Drawing Export
    In This Topic

    NOV Diagram lets you easily save your drawing documents to Visio Drawings in VSDX format.

     Save to File or Stream Directly

    To save directly to a Visio Drawing file call any of the SaveToFile or SaveToStream methods of the drawing view, for example:

    Save to Visio Drawing File
    Copy Code
    drawingView.SaveToFile(@"D:\Documents\VisioDrawing.vsdx");
    

    Save to Visio Drawing Stream
    Copy Code
    drawingView.SaveToStream(stream, new NVisioDrawingFormat());
    

    If you want to customize the Visio drawing export process you can pass an NVisioDrawingSaveSettings instance to the Save method. It contains the following properties:

    • CompressionLevel - the compression level to apply when creating the VSDX file/stream. By default set to BestCompression.
    • EmbedPreview - determines whether to embed a preview (in EMF format) of the document in the generated Visio package. By default set to true. If you are after maximum performance, set this property to false to instruct the Visio exporter not to generate and embed a preview of the document in the resulting Visio package.
    Using Visio Drawing save settings
    Copy Code
    NVisioDrawingSaveSettings visioSaveSettings = new NVisioDrawingSaveSettings();
    visioSaveSettings.CompressionLevel = ENCompressionLevel.BestSpeed;
    visioSaveSettings.EmbedPreview = false;
    view.SaveToFile(@"D:\Documents\VisioDrawing.vsdx", new NVisioDrawingFormat(), visioSaveSettings);
    

    The example above configures the Visio Drawing export for maximum performance by setting the CompressionLevel to BestSpeed and disabling the generation and embedding of document preview in the resulting Visio package.

     Show Save File Dialog

    To show the standard Save File dialog with "Visio Drawing" file type selected by default, use the following overload of the SaveToFile method:

    Save File dialog with Visio Drawing selected by default
    Copy Code
    NVisioDrawingFormat visioDrawingFormat = new NVisioDrawingFormat();
    drawingView.SaveToFile(visioDrawingFormat, null);
    

    To show a Save File dialog with only "Visio Drawing" as a file type, then you should get and execute the export to Visio command action:

    Save File dialog with only Visio Drawing file type
    Copy Code
    NCommandAction exportToVisioAction = drawingView.Commander.GetCommandAction(NDrawingView.ExportToVisioDrawingCommand);
    exportToVisioAction.Execute(drawingView, NCommand.EmptyParameter);
    

     

    See Also