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.