title: itext color for cell data
body: <p>I am using itexsharp to create PDF and have a table with header and rows. I can give colors to my header, but when i add colors to my rows(cell) i cant do that.
  how can I give colors to my rows.</p>
  
  <p>example:</p>
  
  <pre><code> ..................
  :Header1 : Header2 :  //I have a sytle here allreadey
   ...................
  :Row1    : Row2    : //I want to add style here?
  ....................
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>private String WritePDF(DataTable dt)
          {
              String fileName = "";  
  
              //Creating iTextSharp Table from the DataTable data
              PdfPTable pdfTable = new PdfPTable(m_PDFColumnCount);
  
              pdfTable.DefaultCell.Padding = 1;
              pdfTable.WidthPercentage = 100;
              pdfTable.HorizontalAlignment = Element.ALIGN_JUSTIFIED;
             // pdfTable.DefaultCell.BorderWidth = 1;
             //194 214 155
  
  
              this.BuildPDFHeader(pdfTable, "date");
              this.BuildPDFHeader(pdfTable, "time");
              this.BuildPDFHeader(pdfTable, "result");
              this.BuildPDFHeader(pdfTable, "fullname");
              this.BuildPDFHeader(pdfTable, "regarding");            
  
  
  
  
              //Adding DataRow
                  for (int intIndex = 0; intIndex &lt; dt.Rows.Count; intIndex++)
                  {
  
                      dt.Rows[intIndex]["details"] = getplaintext(dt.Rows[intIndex]["details"].ToString());
  
  
                    //Font verdana = FontFactory.GetFont("Verdana", 10, new Color(125, 88, 15));
                    //cell.BackgroundColor = new iTextSharp.text.Color(51, 102, 102);
  
  
                    pdfTable.AddCell(dt.Rows[intIndex]["date"].ToString());
                    pdfTable.AddCell(dt.Rows[intIndex]["time"].ToString());
                    pdfTable.AddCell(dt.Rows[intIndex]["result"].ToString());
                    pdfTable.AddCell(dt.Rows[intIndex]["fullname"].ToString());
                    pdfTable.AddCell(dt.Rows[intIndex]["regarding"].ToString());
  
                    PdfPCell cell = new PdfPCell(new Phrase(dt.Rows[intIndex]["details"].ToString()));
                    cell.Colspan = 5;
                    pdfTable.AddCell(cell);
  
  
                  }
  
              String folderPath = "C:\\PDFs\\"; //should be in configfile.
  
              fileName =  String.Format("{0}{1}{2}",folderPath, dt.Rows[0]["id"].ToString(),".pdf" );
  
              //Exporting to PDF
  
              if (!Directory.Exists(folderPath))
              {
                  Directory.CreateDirectory(folderPath);
              }
              using (FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate ))
              {
                  Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);               
                  PdfWriter.GetInstance(pdfDoc, stream);
                  pdfDoc.Open();
                  pdfDoc.Add(pdfTable);
                  pdfDoc.Close();
                  stream.Close();
              }
  
              return fileName;
  
          }
  
          private void BuildPDFHeader( PdfPTable pdfTable, String strText)
          {
                PdfPCell cell = new PdfPCell(new Phrase(strText)); 
                      cell.BackgroundColor = new iTextSharp.text.Color(51, 102,102);
                      pdfTable.AddCell(cell);
          }
  </code></pre>