How to count word of microsoft office files?

Posted on 2011-03-14
Last Modified: 2012-05-11
Hi guys

i need count word in office software

for ex:
count word of [.doc , docx , .xls , .ppt , .pdf , .rtf , .html , .txt ] files

i need sample file for count word in files

for web application.

thank you
Question by:l0o3
  • 4
  • 2

Expert Comment

ID: 35130399

Author Comment

ID: 35130427
niralbhavsar i need web application code and sample

this is learning of microsoft word
LVL 19

Expert Comment

by:Shahan Ayyub
ID: 35141288

This can be work for MSWord:

Here you need to use:
Microsoft.Office.Interop.Word.WdStatistic.wdStatisticWords   ' Count Words
instead of:
Microsoft.Office.Interop.Word.WdStatistic.wdStatisticPages    ' Count pages

Moreover, Excel Interop should do excel reading job and same with the case of PowerPoint ".ppt" file.

If you want to read ".pdf" then "iTextsharp.dll" might help you(which is special for pdf manipulation).
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 35143201
Shahan i have error in this

Open in new window

WordApp not found

what's this?

i have added .NET>Microsoft.Office.Interop

but error
LVL 19

Accepted Solution

Shahan Ayyub earned 500 total points
ID: 35147098
Did you use this??

Word.ApplicationClass WordApp = new Word.ApplicationClass(); 

Open in new window

Also, write:
Imports Microsoft.Office.Interop

Open in new window

Also Try using with full reference i have used this interop before.

Author Comment

ID: 35147533

Open in new window

WordApp not found

this code not run in web, only for windows application

Author Closing Comment

ID: 35148107
thank you

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question