是否可以更改 Itextsharp List 的字体?
Is it possible to change font for Itextsharp List?
我有 ItextSharp 列表,我需要更改整个列表字体,因为我来自捷克共和国,我们有特殊字符(ěč 和其他...),基本字体不支持这些字符。我已经为 Paragraph
创建了一些我的字体
string font = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "arialbd.ttf");
BaseFont baseFont = BaseFont.CreateFont(font, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font BoldE = new Font(baseFont, 30);
我这样使用它:Paragraph Example = new Paragraph("Some text here", BoldE);
但我不知道列表。我尝试了一些东西,但对我不起作用。
请查看 ListWithLeading 示例。在此示例中,我们使用不同的 ListItem
对象创建 List
。我们为每个项目创建一个 Font
:
Font font = new Font(FontFamily.HELVETICA, 12);
List list1 = new List(12);
list1.add(new ListItem("Value 1", font));
list1.add(new ListItem("Value 2", font));
list1.add(new ListItem("Value 3", font));
document.add(list1);
ListItem
class 扩展了 Paragraph
class,因此任何适用于段落的内容也适用于列表项。
我有 ItextSharp 列表,我需要更改整个列表字体,因为我来自捷克共和国,我们有特殊字符(ěč 和其他...),基本字体不支持这些字符。我已经为 Paragraph
创建了一些我的字体 string font = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "arialbd.ttf");
BaseFont baseFont = BaseFont.CreateFont(font, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font BoldE = new Font(baseFont, 30);
我这样使用它:Paragraph Example = new Paragraph("Some text here", BoldE);
但我不知道列表。我尝试了一些东西,但对我不起作用。
请查看 ListWithLeading 示例。在此示例中,我们使用不同的 ListItem
对象创建 List
。我们为每个项目创建一个 Font
:
Font font = new Font(FontFamily.HELVETICA, 12);
List list1 = new List(12);
list1.add(new ListItem("Value 1", font));
list1.add(new ListItem("Value 2", font));
list1.add(new ListItem("Value 3", font));
document.add(list1);
ListItem
class 扩展了 Paragraph
class,因此任何适用于段落的内容也适用于列表项。