Aspose.Words.Examples.CSharp.Programming_Documents.Working_With_Document.ExtractText.ExtractPrintText C# (CSharp) Method

ExtractPrintText() private static method

private static ExtractPrintText ( string dataDir ) : void
dataDir string
return void
        private static void ExtractPrintText(string dataDir)
        {
            // ExStart:ExtractText
            Document doc = new Document(dataDir);

            // Get the first table in the document.
            Table table = (Table)doc.GetChild(NodeType.Table, 0, true);

            // The range text will include control characters such as "\a" for a cell.
            // You can call ToString and pass SaveFormat.Text on the desired node to find the plain text content.

            // Print the plain text range of the table to the screen.
            Console.WriteLine("Contents of the table: ");
            Console.WriteLine(table.Range.Text);
            // ExEnd:ExtractText   

            // ExStart:PrintTextRangeOFRowAndTable
            // Print the contents of the second row to the screen.
            Console.WriteLine("\nContents of the row: ");
            Console.WriteLine(table.Rows[1].Range.Text);

            // Print the contents of the last cell in the table to the screen.
            Console.WriteLine("\nContents of the cell: ");
            Console.WriteLine(table.LastRow.LastCell.Range.Text);
            // ExEnd:PrintTextRangeOFRowAndTable
        }
        private static void ReplaceText(string dataDir)