Reputation: 10237
I have code like so to write out a line of text:
Paragraph parExecSummHeader = new Paragraph();
. . .
parExecSummHeader.Add("AUTHOR PROFILE ANALYSIS OF " + docNameOnly);
I want the value in docNameOnly to be italicized.
Based on an old post here (which apparently doesn't apply to iText 7), you can do it something like this:
Chunk chunky = new Chunk(docNameOnly, italicize);
parExecSummHeader.Add("AUTHOR PROFILE ANALYSIS OF " + parExecSummHeader.Chunky);
...but that doesn't seem to work with iText 7.
Does anybody know how to accomplish this bit of fanciness?
Upvotes: 0
Views: 520
Reputation: 95918
In iText 7 the Text
class has replaced the Chunk
class of iText 5. Thus, to add differently styled parts to a paragraph, use Text
instances, e.g. like this
Paragraph paragraph = new Paragraph();
paragraph.Add("AUTHOR PROFILE ANALYSIS OF ");
paragraph.Add(new Text("B. Clay Shannon").SetItalic());
doc.Add(paragraph);
for
Upvotes: 1