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

Free Support Forum - aspose.com

Type of list item?

Hi Aspose Team.

First i wanted to thank you for your great documentation and support. Right now i am evaluating your product line Aspose.Word.

While i was working with lists i got a small problem but i’m sure you can help me fast :slight_smile:

My main idea is to represent my word documents in my own xml schema. So if we have the two main list types bullets and numbers:

  • item 1
  • item 2
  1. number 1
  2. number 2
i want to get it presented like this:


item 1
item 1


number 1
number 2


here the code snippet, i iterate through all node of type PARAGRAPH and check the value of the StyleIdentifier with switch/case:

case StyleIdentifier.LIST_PARAGRAPH:

System.out.println(" \n");

if (style == StyleIdentifier.LIST_BULLET){

System.out.println(" \n" + " " + currPar.toTxt() + " β€œ);

}

else if (style == StyleIdentifier.LIST_NUMBER){

System.out.println(” \n" + " " + currPar.toTxt() + " β€œ);

}

System.out.println(” ");

break;

LIST.PARAGRAPH is working without any problem, but BULLET and NUMBER don’t match. Now my question is how to check if a list item is a bullet or a number??

Thank you very much for your help.

Regards


Hi Adam,

Thanks for that. Sure, you can get the number style of a current paragraph using the code below.

paragraph.getListFormat().getListLevel().getNumberStyle();

In your case you want to check for the NumberStyle returned as being either NumberStyle.BULLET or NumberStyle.ARABIC.

If you need any further help please feel free to ask.

Thanks,