I have created a table with following code
Aspose.Pdf.Table tblMainHeader = new Aspose.Pdf.Table();
tblMainHeader.IsFitToPage = true;
tblMainHeader.ColumnWidths = ("550");
Aspose.Pdf.Row rDoc = tblMainHeader.Rows.Add();
rDoc.DefaultCellTextInfo.BackgroundColor = new Aspose.Pdf.Color("Green");
rDoc.DefaultCellTextInfo.Color = new Aspose.Pdf.Color("White");
Aspose.Pdf.Cell clblDocHeader = rDoc.Cells.Add("Documents");
clblDocHeader.DefaultCellTextInfo.FontSize = 12;
Aspose.Pdf.Table tblDocData = new Aspose.Pdf.Table();
tblDocData.IsBroken = false;
tblDocData.IsFitToPage = true;
tblDocData.DefaultCellBorder = new Aspose.Pdf.BorderInfo((int)Aspose.Pdf.BorderSide.All, 0.1F);
tblDocData.ColumnWidths = ("90 250 40 80 90");
DataTable dtDocuments = RiskMaintBL.GetDocumentsPDF(Request["RiskId"]);
Aspose.Pdf.Row rDocHeader = tblDocData.Rows.Add();
rDocHeader.DefaultCellTextInfo.BackgroundColor = new Aspose.Pdf.Color("#99CC00");
rDocHeader.DefaultCellTextInfo.Color = new Aspose.Pdf.Color("White");
Aspose.Pdf.Cell c1header = rDocHeader.Cells.Add("Status");
Aspose.Pdf.Cell c2header = rDocHeader.Cells.Add("Document Name");
Aspose.Pdf.Cell c3header = rDocHeader.Cells.Add("Control Name");
Aspose.Pdf.Cell c4header = rDocHeader.Cells.Add("Added By");
Aspose.Pdf.Cell c5header = rDocHeader.Cells.Add("Added On");
rDocHeader.DefaultCellTextInfo.FontSize = 8;
rDocHeader.DefaultCellTextInfo.IsTrueTypeFontBold = true;
int i;
for (i = 0; i <= dtDocuments.Rows.Count - 1; i++)
{
Aspose.Pdf.Row r11 = tblDocData.Rows.Add();
r11.DefaultCellTextInfo.FontSize = 8;
r11.DefaultRowCellPadding = new MarginInfo();
r11.DefaultRowCellPadding.Left = 2F;
r11.DefaultRowCellPadding.Right = 2F;
r11.DefaultRowCellPadding.Top = 2F;
r11.DefaultRowCellPadding.Bottom = 2F;
int j;
for (j = 0; j <= dtDocuments.Columns.Count - 1; j++)
{
Aspose.Pdf.Cell clbl = r11.Cells.Add((dtDocuments.Rows[i][j]).ToString());
}
}
sec1.Paragraphs.Add(tblMainHeader);
sec1.Paragraphs.Add(tblDocData);
If you notice PDF output, the third column header text is wrapped, and color is also coming in both rows, but for others, the background color is not coming in both rows.
Also, we can see a small white line between the border line and the color of table header text. How can that be fixed?