问题
I am displaying a list using itextsharp in a pdf file .
Some of the Contents in a List item are being Bold as I asked it in my Question :
Bold some text in Pdf List
Now the problem is if I bold some text of Listitem , the List number is also getting Bold.
For Example :
1.Bold Text
it should be
- Bold Text
Here is the Snapshot :
How can I resolve this ?
Here is my Code :
c1 = new Chunk("Earth Pit.", FontFactory.GetFont(FontFactory.TIMES_BOLD, 10,iTextSharp.text.Font.UNDERLINE));
c2 = new Chunk(" The existing earth...", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10));
p_chunk = new Paragraph();
p_chunk.Add(c1);
p_chunk.Add(c2);
lst_terms.Add(new iTextSharp.text.ListItem(p_chunk));
回答1:
This works for me:
Chunk c1 = new Chunk("Earth Pit.", FontFactory.GetFont(FontFactory.TIMES_BOLD, 10,iTextSharp.text.Font.UNDERLINE));
Chunk c2 = new Chunk(" The existing earth...", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 10));
ListItem li = new ListItem("", FontFactory.GetFont(TIMES_ROMAN, 10));
p.Add(c1);
p.Add(c2);
lst_terms.Add(li);
Why are you creating a Paragraph
object when you actually need a ListItem
?
来源:https://stackoverflow.com/questions/37831344/make-listitem-text-bold-but-not-the-list-icon-itextsharp