This project has moved. For the latest updates, please go here.

can i access the number of words and other statistics in doc file

Jan 12, 2011 at 2:43 PM
Edited Jan 12, 2011 at 2:44 PM

Microsoft Office Word shows this kind of information in the status bar.

is there any  way to access this kind of information specially number of words with docx library??

I could not find any at my first try.

Coordinator
Jan 13, 2011 at 9:41 AM
imanabidi,

at the moment DocX does not support document statistics.
That said, word and character counts could be easily accomplished.

Below is a very simple example. I am sure that given some thought you could make this much better.
You might want to omit certain characters such as tabs?

int char_count = document.Text.length;

MatchCollection collection = Regex.Matches( document.Text, @"[\S]+");
int word_count = collection.Count;

Kind regards,
Cathal