Diagram / Import and Export / Import / GEDCOM Import
In This Topic
    GEDCOM Import
    In This Topic

    NOV Diagram can import family trees stored in the popular Genealogical Data Communication (GEDCOM) format.

     Family Tree Library

    Importing of GEDCOM files requires the family tree shapes library to be loaded first. It is located in the following subfolder in the installation folder of NOV:

    • Resources\ShapeLibraries\Family Tree\Family Tree Shapes.nlb

    It is best to load the file format library using the GEDCOM file format's helper method in the entry point of the application. Thus you will have to load it only once, for example in the entry point of the application or right before creating the first family tree diagram.

    Like most file operations in NOV, loading of the family tree library from file is an asynchronous operation, so the Then method of the returned promise should be used to get notified when the family tree library has been loaded.

    The code below demonstrates how to load the family tree library:

    Load the family tree shapes library
    Copy Code
    // Load the GEDCOM file format's family tree library (this needs to be done only once)
    NFile libraryFile = NApplication.ResourcesFolder.GetFile(NPath.Current.Combine(
            "ShapeLibraries", "Family Tree", "Family Tree Shapes.nlb"));
    NDrawingFormat.Gedcom.LoadFamilyTreeLibraryFromFileAsync(libraryFile).Then(
        delegate (NUndefined ud)
        {
            // Family tree library loaded successfully, so create the family tree diagram
            CreateFamilyTree(drawingView.ActivePage);
        },
        delegate (Exception ex)
        {
            // Failed to load the family tree library
        }
    );
    
     Importing GEDCOM Files and Streams

    After the family tree shapes library is loaded, GEDCOM files can be imported. The following code examples show how to load GEDCOM data from file and from stream in a drawing view:

    Importing GEDCOM data from a file
    Copy Code
    drawingView.LoadFromLocalFile(@"D:\Documents\MyFamilyTree.ged");
    
    Importing a GEDCOM data from a stream
    Copy Code
    drawingView.LoadFromStream(stream, NDrawingFormat.Gedcom);
    
    See Also