Click here to Skip to main content
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 Maciej Los 225
1 CHill60 170
2 Manfred R. Bihy 170
3 _Amy 155
4 Sergey Alexandrovich Kryukov 144
0 OriginalGriff 7,320
1 Sergey Alexandrovich Kryukov 6,043
2 Maciej Los 3,754
3 Peter Leow 3,448
4 CHill60 2,572


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 15 Jun 2012
Copyright © CodeProject, 1999-2014
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