## Page.GetChildNodes&lt;T1&gt; method

Obtener todos los nodos secundarios de la página por tipo de nodo.

```csharp
public override List<T1> GetChildNodes<T1>()
    where T1 : class, INode
```

| Parámetro | Descripción |
| --- | --- |
| T1 | El tipo de elementos en la lista devuelta. |

### Valor_devuelto

Una lista de nodos secundarios.

### Ejemplos

Muestra cómo obtener todo el texto del documento.

```csharp
// La ruta al directorio de documentos.
string dataDir = RunExamples.GetDataDir_Text();

// Cargue el documento en Aspose.Note.
Document oneFile = new Document(dataDir + "Aspose.one");

// Recuperar texto
string text = string.Join(Environment.NewLine, oneFile.GetChildNodes<RichText>().Select(e => e.Text)) + Environment.NewLine;

// Imprimir texto en la pantalla de salida
Console.WriteLine(text);
```

Muestra cómo obtener todo el texto de la página.

```csharp
// La ruta al directorio de documentos.
string dataDir = RunExamples.GetDataDir_Text();

// Cargue el documento en Aspose.Note.
Document oneFile = new Document(dataDir + "Aspose.one");

// Obtener la lista de nodos de la página
var page = oneFile.GetChildNodes<Page>().FirstOrDefault();

if (page != null)
{
    // Recuperar texto
    string text = string.Join(Environment.NewLine, page.GetChildNodes<RichText>().Select(e => e.Text)) + Environment.NewLine;
    // Imprimir texto en la pantalla de salida
    Console.WriteLine(text);
}
```

Muestra cómo pasar por todas las páginas y hacer un reemplazo en el texto.

```csharp
// La ruta al directorio de documentos.
string dataDir = RunExamples.GetDataDir_Text();

Dictionary<string, string> replacements = new Dictionary<string, string>();
replacements.Add("Some task here", "New Text Here");

// Cargue el documento en Aspose.Note.
Document oneFile = new Document(dataDir + "Aspose.one");

// Obtener todos los nodos RichText
IList<RichText> textNodes = oneFile.GetChildNodes<RichText>();

foreach (RichText richText in textNodes)
{
    foreach (KeyValuePair<string, string> kvp in replacements)
    {
        // Reemplazar el texto de una forma
        richText.Replace(kvp.Key, kvp.Value);
    }
}

dataDir = dataDir + "ReplaceTextOnAllPages_out.pdf";

// Guardar en cualquier formato de archivo compatible
oneFile.Save(dataDir, SaveFormat.Pdf);
```

Muestra cómo pasar el texto de la página y hacer un reemplazo.

```csharp
// La ruta al directorio de documentos.
string dataDir = RunExamples.GetDataDir_Text();

Dictionary<string, string> replacements = new Dictionary<string, string>();
replacements.Add("voice over", "voice over new text");

// Cargue el documento en Aspose.Note.
Document oneFile = new Document(dataDir + "Aspose.one");

IList<Page> pageNodes = oneFile.GetChildNodes<Page>();

// Obtener todos los nodos RichText
IList<RichText> textNodes = pageNodes[0].GetChildNodes<RichText>();

foreach (RichText richText in textNodes)
{
    foreach (KeyValuePair<string, string> kvp in replacements)
    {
        // Reemplazar el texto de una forma
        richText.Replace(kvp.Key, kvp.Value);
    }
}

// Guardar en cualquier formato de archivo compatible
dataDir = dataDir + "ReplaceTextOnParticularPage_out.pdf";
oneFile.Save(dataDir, SaveFormat.Pdf);
```

### Ver también

* interface [INode](../../inode/)
* class [Page](../)
* espacio de nombres [Aspose.Note](../../page/)
* asamblea [Aspose.Note](../../../)


