Click here to Skip to main content
11,703,617 members (64,894 online)
Rate this: bad
good
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 20: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
0 OriginalGriff 550
1 Maciej Los 530
2 Sergey Alexandrovich Kryukov 381
3 Andy Lanng 294
4 CPallini 195
0 OriginalGriff 8,744
1 Sergey Alexandrovich Kryukov 7,747
2 CPallini 5,107
3 Maciej Los 4,716
4 Mika Wendelius 3,606


Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 15 Jun 2012
Copyright © CodeProject, 1999-2015
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