We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Word Count & Return all words from Document

Thread ID:





71041 Jan 13,2008 10:09 AM UTC Jan 14,2008 06:48 AM UTC WinForms 1
Tags: DocIO
Asked On January 13, 2008 10:09 AM UTC

Hi all,

i'm evaluating the Syncfusion.DocIO coz' we need a logic to get every word in a *.doc file as a single string object. How can this be done?

Can this work like the following example (i know this is not a working one ;-)

Function GetWords() As ArrayList

Dim wordsArray As New ArrayList
Dim currentWord As String

Dim document As DocIO.DLS.WordDocument = _
New DocIO.DLS.WordDocument

document.Open(fileName, FormatType.Doc)

For Each currentWord In document.GetText

Return wordsArray
End Function

Your help is much appreciated...

Administrator [Syncfusion]
Replied On January 14, 2008 06:48 AM UTC

Hi Mac,

Thank you for evaluating Syncfusion products.

Word count

You can display number of words in a document using WordCount property of document as follows.



To return all the words in a document

We don't have direct support for displaying all the words in a document. You need to enumerate the document elements starting from sections and need to check whether each paragraph item in the section contains any Text to display. Here is a code snippet.


// Enumerate the document elements starting from sections
foreach (IWSection sec in doc.Sections)
foreach (IWParagraph para in sec.Paragraphs)
for (int i = 0; i < para.ChildEntities.Count; i++)
Syncfusion.DocIO.DLS.IParagraphItem pItem = para[i] as Syncfusion.DocIO.DLS.IParagraphItem;

//Check if the type of element is a text
if (pItem is IWTextRange)
IWTextRange cellText = pItem as IWTextRange;
String s = cellText.Text.ToString();



Finally , you can display all the words in a string IWTextRange.Text.

Sample reference

Please refer the sample that demonstrates the same.


Please let me know if this helps you.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon