首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >用iTextSharp在一个句子中加粗一个单词?

用iTextSharp在一个句子中加粗一个单词?
EN

Stack Overflow用户
提问于 2018-02-11 01:33:36
回答 2查看 0关注 0票数 0

代码

代码语言:txt
复制
    pdftb4 = new PdfPTable(1);
    pdftb4.WidthPercentage = 100;
    width = new float[1];
    width[0] = 0.7F;
    pdftb4.SetWidths(width);

  pdfcel4 = new PdfPCell(new Phrase("\n REASON(S) FOR CANCELLATION: See Statutoryreason(s) designated by Code No(s) 1 on the reverse side hereof", docBlackFont10));
    pdfcel4.Border = 0;
    pdfcel4.HorizontalAlignment = Element.ALIGN_LEFT;
    pdftb4.AddCell(pdfcel4);
   objDocument.Add(pdftb4);
EN

回答 2

Stack Overflow用户

发布于 2018-02-11 10:08:56

一个简单的例子是:

代码语言:txt
复制
var normalFont = FontFactory.GetFont(FontFactory.HELVETICA, 12);
var boldFont = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 12);

var phrase = new Phrase();
phrase.Add(new Chunk("REASON(S) FOR CANCELLATION:", boldFont));
phrase.Add(new Chunk(" See Statutoryreason(s) designated by Code No(s) 1 on the reverse side hereof", normalFont));
票数 0
EN

Stack Overflow用户

发布于 2018-02-11 11:21:03

也可以创建类似于

代码语言:txt
复制
Font verdanaBold = FontFactory.GetFont("Verdana", 7f, Font.BOLD);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100007376

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档