using System;
//Add the "Microsoft.Office.Interop.Word" extension from Project -> Add Reference...
using Microsoft.Office.Interop.Word;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
try
{
Application application = new Application();
Document document = application.Documents.Open("d:\\file.doc");
int total_words = document.Words.Count;
application.Quit();
Console.WriteLine("totla words: {0}", total_words); // totla words: 9083
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
/*
run:
totla words: 9083
*/