BuiltInDocumentProperties.Lines not accurate


I have noticed that BuiltInDocumentProperties.Lines does not always give an accurate value.
After reading many posts on this forum:
I understand that MS stores this in the document and Aspose.Words uses this value. If I open the document in MS Word, go to properties and view the statistics, MS Word will ask me to save on close and if I do the BuiltInDocumentProperties.Lines will be correct.
I also understand that just by using Aspose.Words you can call Document.UpdateWords() to update the other statistics. My question:

Through only Aspose.Words, are we able to update the document to get an accurate Lines count? We are looking to use Aspose.Words without the need of MS Word.


As an example I have include 2 documents.
tp1.docx - Save original document.
tp2.docx - Open tp1.docx, View property statistics in Word and then save as tp2.docx.
You will notice with Aspose.Words, tp1 shows 1 line (bad) and tp2 shows 3 lines (good)
testdocs.zip (18.1 KB)


We have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-18315. We will further look into the details of this requirement and will keep you updated on the status of the linked issue.

1 Like


Please use the Document.UpdateWordCount Method (Boolean) overload to get the correct number of lines:

Document doc = new Document("E:\\temp\\TestDocs\\tp1.docx");

Hope, this helps.

Hi Awais,

Thank you! That was the answer. I did not realize there was an overload.


Regarding WORDSNET-18315, we have completed the work on your issue and concluded to close this issue as ‘Not a Bug’. Please see my previous post for workaround.