Click here to Skip to main content
12,070,351 members (58,664 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET PDF itextsharp
I am using iTextSharp.dll

var Title = "This is title";
var Description = "This is description";
 
Innertable.AddCell(new PdfPCell(new Phrase(string.Format("{0} {1}", Title, Description.Trim()), listTextFont)) { BackgroundColor = new BaseColor(233, 244, 249), BorderWidth = 0, PaddingTop = 4, PaddingLeft = -240, PaddingBottom = 5, HorizontalAlignment = Element.ALIGN_LEFT });

Can we set differnt font color for title and Description, but only using single cell without creating new table.

Thanks in advance. Any help in this matter would be greatly appreciated.
Posted 14-Jun-12 21:40pm

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Okay.. i finally managed to solve it myself...

var Title ="This is title" 
    var (Description="This is description";
    var ListTitleCompFont = FontFactory.GetFont("trebuchet ms", 6);
    ListTitleCompFont.SetColor(8, 61, 134);
    ListRowContent = new PdfPCell();
    Title = Title.Trim();
    Title = Title + " ";
    Phrase ListTitlePhrase = new Phrase();
    ListTitlePhrase.Add(new Chunk(Title, ListTitleCompFont));
    ListTitlePhrase.Add(new Chunk(Description.Trim(), listTextFont));
    
    Innertable.AddCell(new PdfPCell(ListTitlePhrase) { BackgroundColor = new BaseColor(233, 244, 249), BorderWidth = 0, PaddingTop = 4, PaddingLeft = -240, PaddingBottom = 5, HorizontalAlignment = Element.ALIGN_LEFT });


Patience always pays...
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160208.1 | Last Updated 15 Jun 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100