Free Support Forum - aspose.com

BuiltInDocumentProperties.Lines not accurate


#1

Hi,

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.

Thanks,
Charles

PS
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)


#2

@ccuster68,

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.


#3

@ccuster68,

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

Document doc = new Document("E:\\temp\\TestDocs\\tp1.docx");
doc.UpdateWordCount(true);
Console.WriteLine(doc.BuiltInDocumentProperties.Lines); 

Hope, this helps.


#5

Hi Awais,

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