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

Free Support Forum - aspose.com

Ability to read the last paragraph heading number used in the word document

Hi,
We are currently using Aspose Words Java version in our application.

We have a specific requirement where we need to read the last paragraph heading number used in the word document.

E.g.
- Attached four MS Word documents such as “Draft1.docx”, “Draft2.docx”, “Draft3.docx” and “Draft4.docx”.
- These document have paragraph Headings with numbers assigned for those headings.
- Some of these documents also have used “lvlOverride” and “startOverride” attributes defined to override the heading numbers from certain paragraph heading onward… Refer to the related issue raised in thread -
- So we need to consider “lvlOverride” and “startOverride” attributes as well while identifying the last last paragraph heading number used in the word document

Our requirement is that -
We need the ability to read the attached documents and able to read the last paragraph heading number used in these word documents…

They should read as follows:
* Draft1 - last heading number is 2.2
* Draft2 - last heading number is 14.2.1
* Draft3 - last heading number is 18.4.1
* Draft4 - last heading number is 9


Need Help…
Does Aspose Words Java API supports this feature to read the last paragraph heading number used in the word document?
Can you please help to achieve this…
or take this as enhancement request if currently it is not available in Aspose API.

Thanks,
-Satya

Hi Satya,

Thanks for your inquiry. Please use ListLabel.LabelString property to get a string representation of list label. Hope this helps you.

Document doc = new Document(MyDir + "Draft1.docx");
doc.updateListLabels();

ListLabel label = doc.getLastSection().getBody().getLastParagraph().getListLabel();
System.out.println(label.getLabelString());
<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”;”>
oraspose:
So we need to consider “lvlOverride” and “startOverride” attributes as well while identifying the last last paragraph heading number used in the word document
We have already answered your query here in this post. Please follow that thread for further proceedings.