Accessing Word document properties without Interop.Word? RRS feed

  • Question

  • Greetings,

    My apologies if this is not the correct place to post this question, this is my first time in the MSDN forums...

    I'm hoping that someone can point me in the right direction.  I've been searching Google for a few days, but cannot find a good solution for my problem and I suspect I'm just not asking Google for the right things. 

    I am trying to write a simple program in C# that iterates through a folder containing Word 2003 .doc files, spits out a page count for each file and finally a grand total page count.  From some example solutions I've found online, I've managed to develop a prototype for this program that uses the Microsoft.Office.Interop.Word assembly to open a word application (not visible), loop through the directory opening each file and spitting out a page count, then closing the file.  Now this works ok, and does the job, but it's way too slow to be useful for my needs.  A sample run of 100 documents took about an hour to run, which basically makes the solution useless since my goal is to iterate through a folder of about 80,000 files.

    Is anyone able to suggest another method for accessing word doc page counts other than this?  I notice that when you right click a word doc and check its properties (in Windows 7), you can find the page count in the details tab and I doubt the OS is using this same method.  Is this done through WinAPI somehow?

    I'm not looking for source code from anyone here, but mearly a link or suggestion on search terms for google or MSDN that will point me in the right direction.

    Thanks for any assistance you can provide.

    Friday, May 27, 2011 2:37 AM