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

Free Support Forum - aspose.com

BuiltInDocumentProperties.Lines Property returns wrong values

Hi,

When retrieving the BuiltInDocumentProperties.Lines, it returns wrong value. I have gone through the old forum to find, is there solution for it?. You have mentioned that you are not able to calculate the exact no of lines. That's ok. My Question is, BuiltIn properties are just stored with the document stream. Why Aspose.Words is not returning the value stored in the document properly. Is this bug? or Is anyother way to get the no of lines? Please comment on this as soon as possible.

Regards,
Vijay

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Actually, Aspose.Words returns the value stored in the document. However, if the document was created using some third-party tool or for some other reason, the values of built-in properties stored in the document can be out of date. When you open such document in MS Word, it automatically updated built-in properties, that is why you see the actual values in MS Word.

We will consider adding an ability to update BuiltInDocumentProperties.Lines property. I linked your request to the appropriate issue. You will be notified as soon as such feature is available.

Best regards.

H Alexey,

Thanks for your update.

The document is created by MS Word. I just invoked the word count and resaved the document using MS Word and tried. But unfortunately i'm not getting the correct value. I have attached a screenshot to show the value retrieved by Aspose.Words (27 lines) and value listed in MS Word (21 lines). Also attached a simple application to show this issue. Can you look into the application and let me know what wrong with it. Eagerly waiting for your reply

Regards,

Vijay

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I performed another test. I saved your document in DOCX format and get XML, which represents built-in properties. Here it is:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">

<Template>Normal.dotm</Template>

<TotalTime>0</TotalTime>

<Pages>1</Pages>

<Words>154</Words>

<Characters>800</Characters>

<Application>Microsoft Office Word</Application>

<DocSecurity>0</DocSecurity>

<Lines>27</Lines>

<Paragraphs>13</Paragraphs>

<ScaleCrop>false</ScaleCrop>

<HeadingPairs>

<vt:vector size="2" baseType="variant">

<vt:variant>

<vt:lpstr>Title</vt:lpstr>

</vt:variant>

<vt:variant>

<vt:i4>1</vt:i4>

</vt:variant>

</vt:vector>

</HeadingPairs>

<TitlesOfParts>

<vt:vector size="1" baseType="lpstr">

<vt:lpstr>MT Initials</vt:lpstr>

</vt:vector>

</TitlesOfParts>

<Company>TransPortal, LLC</Company>

<LinksUpToDate>false</LinksUpToDate>

<CharactersWithSpaces>941</CharactersWithSpaces>

<SharedDoc>false</SharedDoc>

<HyperlinksChanged>false</HyperlinksChanged>

<AppVersion>12.0000</AppVersion>

</Properties>

As you can see number of lines is 27, exactly as Aspose.Words returns.

Best regards.

Hi Alexey,

Thank you for your clear description.

MS Word shows 21 lines when i perform word count option and then i resaved the document. The value 21 should be saved in the document right? Why the value 27 got saved. Is MS Word includes anything additionally with this count? Can you state any reason for that?

Regards,
Vijay

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Due to OOXML specification, Lines element specifies the total number of lines in a document when last saved by a conforming producer if applicable. Most likely MS Word shows some calculated on the fly value, when you open document properties. I found also that if you right click on the file and select propertied, you will see the same value as Aspose.Words returns (see the attached screenshot)

Best regards.

Hi Alexey,

Thank you very much for the information.

Regards,
Vijay