List lettering and bulleting problems in iText in Java

How come this works:

lA = new List(List.ORDERED, List.ALPHABETICAL); 
lA.setPostSymbol(") ");

but this doesn't:

lQL = new List(List.UNORDERED); 
lQL.setPostSymbol("  ");


In the first example in front of every item is "a) " or "b) " or "c) " etc... In the second example in front of every item is only "=".

Before any ideas, two things. Firstly, I can't do it this way: lQL.setListSymbol("= ");. I could explain it, but just go with it, it's simpler. Secondly, I tried setting second string to "k " (so it's not only spaces), but the output was still "="...

What's happening?


Because you have explicitly indicated that you want an unordered list with List.UNORDERED. Thus, you'll not get any order for your items, and therefore the post symbol will not be used.

From the documentation of setPostSymbol:

Sets the String that has to be added after a number or letter in the list symbol.

And from the source code of List:

  137       /**
  138        * In case you are using numbered/lettered lists, this String is added after the number/letter.
  139        * @since   iText 2.1.1
  140        */
  141       protected String postSymbol = ". ";

This number or letter will only be added for ordered lists, i.e., List.ORDERED. If you inspect the first argument of the constructor of List, you'll see that it receives a boolean to indicate if the list is numbered or not. Since you are passing it List.UNORDERED, whose value is false, you won't get a numbered list, and thus, postSymbol will not be appended.

Need Your Help

Jquery how to get specific css values from css properties with stacked value options such as font-family

jquery css properties fonts selector

Is there a way to get the first or any other specific value item from css property value stack in Jquery?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.