using System; using Aspose.Words; namespace ReadWordDocumentInCSharp { class Program { static void Main(string[] args) // Main function to read Word document in C# { // Create and load license to read DOCX without trial limits License licRotateImage = new License(); licRotateImage.SetLicense("Aspose.Word.lic"); // Load the source Word file to be read Document doc = new Document("input.docx"); // Read all the paragraph in the document and display its contents foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true)) Console.WriteLine(para.ToString(SaveFormat.Text)); // Read all the Runs in the document and display style and text foreach (Run run in doc.GetChildNodes(NodeType.Run, true)) { Font font = run.Font; Console.WriteLine(font.Name + "," + font.Size.ToString()); Console.WriteLine(run.Text); } System.Console.WriteLine("Done"); } } }