2016-06-15 5 views
0

J'affiche une liste en utilisant itextsharp dans un fichier pdf.Rendre le texte ListItem gras mais pas l'icône de liste itextsharp

Certains des matières dans un élément de liste sont gras comme je l'ai demandé dans ma question:

Bold some text in Pdf List

Maintenant, le problème est de savoir si je gras un texte de ListItem, le numéro de liste est également obtenir Audacieux.

Par exemple:

1.Bold Texte

il devrait être

  1. Texte gras

Voici l'instantané:

enter image description here

Comment puis-je résoudre ce problème?

Voici mon 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)); 

Répondre

0

Cela fonctionne pour moi:

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); 

Pourquoi quand vous avez besoin en fait un ListItem créez-vous un objet Paragraph?

+0

ok merci monsieur cela a fonctionné pour moi :) –