Diagram / Diagram DOM / Drawings / Loading Drawings
Loading Drawings

Loading drawings in NOV Diagram is done by calling one of the Load... method overloads of the NDrawingView class or the drawing format you want to load from.

The supported drawing formats are exposed as static properties of the NDrawingFormat class, for example: NDrawingFormat.NevronBinary, NDrawingFormat.Visio and so on. For a list of all supported drawing formats open the Diagram File Formats Overview topic.

 Load from File or Stream Directly
  1. Load a Nevron Binary Drawing file synchronously
    To load a Nevron Drawing synchronously from a local file call the LoadFromLocalFile method of the drawing view. This method doesn't work on sandboxed platforms like Blazor WebAssembly.
    Copy Code
    drawingView.LoadFromLocalFile(@"D:\Documents\MyDrawing.ndb");
    
  2. Load a Nevron Binary Drawing file asynchronously
    To load a Nevron Drawing asynchronously call the LoadFromFileAsync method of the drawing view. Calling this method shows a loader over the drawing view until the loading completes. The method returns a promise, which can be used to get notified when the loading completes.
    Copy Code
    drawingView.LoadFromFileAsync(@"D:\Documents\MyDrawing.ndb").Then(
        delegate (bool success)
        {
        },
        delegate (Exception ex)
        {
        }
    );
    
  3. Load from a Nevron Binary Drawing stream using a drawing view
    To load a drawing from a stream call the LoadFromStream method of the drawing view and pass the drawing format to load:
    Copy Code
    drawingView.LoadFromStream(stream, NDrawingFormat.NevronBinary);
    
  4. Load a drawing document from a Nevron Binary Drawing stream directly
    To load a drawing from a stream directly, without using a drawing view, call the LoadFromStream method of the format you want to load from:
    Copy Code
    NDrawingDocument drawingDocument = NDrawingFormat.NevronBinary.LoadFromStream(stream);
    
 Show an Open File Dialog

The OpenFileAsync method shows an Open File dialog with all supported drawing formats:

Open File dialog
Copy Code
drawingView.OpenFileAsync();

If you want a specific format to be selected by default, pass it as an argument:

Open File dialog with a specific file format selected
Copy Code
drawingView.OpenFileAsync(NDrawingFormat.NevronBinary);
See Also