C# iTextSharp列表项不同字体';问题

C# iTextSharp列表项不同字体';问题,c#,itextsharp,C#,Itextsharp,我需要使用iTextSharp在我的PDF上显示这样的文本 " 提高学习和记忆能力的建议 •集中注意力:为了记住一些东西,你需要学习它。只有当你足够注意它时,学习才有可能。只有当你在学习时集中注意力时,你才能将信息保留更长的时间 •尽可能多地使用感官:重写信息的物理行为有助于将其印在大脑中。即使你是视觉学习者,也要大声朗读你想记住的内容。如果你能有节奏地背诵,效果会更好。 " 我试着用手来做这件事 ListItem firstRecommend = new ListItem(new Chunk(

我需要使用iTextSharp在我的PDF上显示这样的文本

" 提高学习和记忆能力的建议

集中注意力:为了记住一些东西,你需要学习它。只有当你足够注意它时,学习才有可能。只有当你在学习时集中注意力时,你才能将信息保留更长的时间

尽可能多地使用感官:重写信息的物理行为有助于将其印在大脑中。即使你是视觉学习者,也要大声朗读你想记住的内容。如果你能有节奏地背诵,效果会更好。 "

我试着用手来做这件事

ListItem firstRecommend = new ListItem(new Chunk("Concentrate:", new Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 11, Font.BOLD, BaseColor.BLUE)));
            firstRecommend.Add(new Chunk("In order to remember something you need to learn it. Learning is possible only if you pay enough attention to it. You will retain information for a longer period of time only if you concentrate properly at the time of learning."
                                , new Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL, BaseColor.BLUE)));
            recommendationList.Add(firstRecommend);
但它不起作用,整个文本是粗体而不是部分粗体

这也不起作用

ListItem FirstRecommendable=新的ListItem(新的区块(“浓缩:”,新字体(iTextSharp.text.Font.FontFamily.TIMES_-ROMAN,11,Font.BOLD,BaseColor.BLUE)); firstrecomment.Chunks.Add(新Chunk)(“为了记住你需要学习的东西,只有当你足够注意它时,学习才有可能。只有当你在学习时集中注意力时,你才能将信息保留更长的时间。” ,新字体(iTextSharp.text.Font.FontFamily.TIMES_ROMAN,11,Font.NORMAL,BaseColor.BLUE)); 推荐列表。添加(首次推荐)

pdf上只显示粗体部分,因为我注意到ListItem.Chunks是只读的


如何使其工作???

您可以尝试先创建一个段落,然后将其添加到列表项中

请参阅下面的代码

    Chunk c1 = new Chunk("Concentrate:", new Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 11, Font.BOLD, BaseColor.BLUE)));
    Chunk c2 = new Chunk("In order to remember something you need to learn it. Learning is possible only if you pay enough attention to it. You will retain information for a longer period of time only if you concentrate properly at the time of learning.", new Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL, BaseColor.BLUE)));

    Pharagraph p2 = new Pharagraph();
    p2.Add(c1);
    p2.Add(c2);

    ListItem firstRecommend = new ListItem(p2);

您可以尝试先创建一个段落,然后将其添加到listitem

请参阅下面的代码

    Chunk c1 = new Chunk("Concentrate:", new Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 11, Font.BOLD, BaseColor.BLUE)));
    Chunk c2 = new Chunk("In order to remember something you need to learn it. Learning is possible only if you pay enough attention to it. You will retain information for a longer period of time only if you concentrate properly at the time of learning.", new Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL, BaseColor.BLUE)));

    Pharagraph p2 = new Pharagraph();
    p2.Add(c1);
    p2.Add(c2);

    ListItem firstRecommend = new ListItem(p2);