## Notebook.RemoveChild method

Entfernt den untergeordneten Knoten.

```csharp
public INotebookChildNode RemoveChild(INotebookChildNode oldChild)
```

| Parameter | Typ | Beschreibung |
| --- | --- | --- |
| oldChild | INotebookChildNode | Der zu entfernende Knoten. |

### Rückgabewert

Der entfernte Knoten.

### Beispiele

Zeigt, wie Sie von einem Notizbuch aus auf alle Abschnitte zugreifen.

```csharp
string inputFile = "notebook.onetoc2";
string dataDir = RunExamples.GetDataDir_NoteBook();

Notebook rootNotebook = new Notebook(dataDir + inputFile);

IList<Document> allDocuments = rootNotebook.GetChildNodes<Document>();
foreach (Document document in allDocuments) 
{
    Console.WriteLine(document.DisplayName);
}
```

Zeigt, wie ein Abschnitt aus einem Notizbuch entfernt wird.

```csharp
// Der Pfad zum Dokumentenverzeichnis.
string dataDir = RunExamples.GetDataDir_NoteBook();

// Ein OneNote-Notizbuch laden
var notebook = new Notebook(dataDir + "test.onetoc2");

// Die untergeordneten Knoten durchlaufen, um das gewünschte untergeordnete Element zu suchen
foreach (var child in new List<INotebookChildNode>(notebook))
{
    if (child.DisplayName == "Remove Me")
    {
        // Entfernen Sie das untergeordnete Element aus dem Notizbuch
        notebook.RemoveChild(child);
    }
}

dataDir = dataDir + "RemoveChildNode_out.onetoc2";

// Speichern Sie das Notizbuch
notebook.Save(dataDir);
```

Zeigt, wie ein Notizbuch gespeichert wird.

```csharp
// Der Pfad zum Dokumentenverzeichnis.
string dataDir = RunExamples.GetDataDir_NoteBook();

var notebook = new Notebook(dataDir + "test.onetoc2", new NotebookLoadOptions() { DeferredLoading = false });

notebook.Save(dataDir + "notebook_out.onetoc2", new NotebookOneSaveOptions() { DeferredSaving = true});

if (notebook.Any())
{
    var childDocument0 = notebook[0] as Document;

    childDocument0.Save(dataDir + "Not Locked_out.one");

    var childDocument1 = notebook[1] as Document;

    childDocument1.Save(dataDir + "Locked Pass1_out.one", new OneSaveOptions() { DocumentPassword = "pass" });

    var childDocument2 = notebook[2] as Document;

    childDocument2.Save(dataDir + "Locked Pass2_out.one", new OneSaveOptions() { DocumentPassword = "pass2" });
}
```

### Siehe auch

* interface [INotebookChildNode](../../inotebookchildnode/)
* class [Notebook](../)
* namensraum [Aspose.Note](../../notebook/)
* Montage [Aspose.Note](../../../)


