Interop統計WORD文字数


中国語の文字を統計するには、
WdStatistic
サンプルコードは次のとおりです.
 public static void WordCount(string filePath)
        {
            Microsoft.Office.Interop.Word.Application wordApp = null;
            Microsoft.Office.Interop.Word.Document doc = null;


            int wordCount = 0;
            object missing = Type.Missing;
            object saveChanges = false;
            object includeFootnotesAndEndnotes = false;
            Microsoft.Office.Interop.Word.WdStatistic stats = Microsoft.Office.Interop.Word.WdStatistic.wdStatisticWords;
             Microsoft.Office.Interop.Word.WdStatistic statsAsia = Microsoft.Office.Interop.Word.WdStatistic.wdStatisticFarEastCharacters;
            try
            {
                wordApp = new Microsoft.Office.Interop.Word.Application();
                doc = wordApp.Documents.Open(filePath);
                //doc.Content.Text = text;
                wordCount = doc.ComputeStatistics(stats, ref includeFootnotesAndEndnotes);
               int asiaWordsCount = doc.ComputeStatistics(statsAsia, ref includeFootnotesAndEndnotes);
                wordApp.Quit(ref saveChanges, ref missing, ref missing);
            }
            catch (Exception) { }
            finally
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(doc);
                doc = null;
            }


            

        }