We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get wrong word count

hi i m evaluator of the word count i have 30 days license for the component i want word count of the doc file my code is bellow

Dim lic As Aspose.Words.License = New Aspose.Words.License
lic.SetLicense(HttpContext.Current.Server.MapPath("bin").ToString + "\" + "Aspose.Custom.lic")
Dim doc As New Aspose.Words.Document(file)
Dim count As Integer = 0
count = doc.BuiltInDocumentProperties.Words
Return count

and my document is attach with this which has 27 words but i get 30 words while i m checking it through component so please any one tell me why this done.

Hi,
Thank you for reporting to us. I managed to reproduce the problem. I created an issue #3913 in our defects database and we will investigate whether and when it can be fixed. Please expect a reply before the next hotfix (within 2-3 weeks).
Best regards.

Sorry, we have closed this defect because this is not a bug. Just call

doc.UpdateWordCount();

to get the correct result.
Thank you.

HI,
Still I am getting the wrong line count after calling doc.UpdateWordCount();
Please can any one let me know what i will do for this.

hi that method is only for get true word count from that we can not get true line count for that you have to contact support team

Hi
Thanks for your request. Unfortunately, Aspose.Words can’t update lines count yet. That’s why you should update this value using MS Word.
If you use the code like the following code then you will get wrong line count.

Document doc = new Document(@"290_99846_namin@globalmeddata.net\in.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Test"); //write line into the document
int count = doc.BuiltInDocumentProperties.Lines; //will return wrong value

Best regards.