Adding BorderInfo to Table

Hi AsposeSupport,
Is it possible to Add Border to a Table Cell such that the Border Color differs. For example, top, left and right border I want Black and Bottom Border I want white color(ie, should be empty).
I am using the below function to set border. Pls suggest modifications to implement the mentioned functionality.

ownerInfotable.setDefaultCellBorder(new BorderInfo(
BorderSide.Left | BorderSide.Top | BorderSide.Bottom | BorderSide.Right, 0.25F, Color.getGray()));

@abrahamaby,

You cannot do it like that. You can only add one sec of color per object, be this table, row or cell.

What I would do is do Left, Top, and Right. So on the next row, you don’t necessarily do the top if you do not want the line in between to appear.

Check how I control the table border in my code example.

The table has left, top, and right. The last row has bottom.

private void Logic()
{
    Document doc = new Document();
    var page = doc.Pages.Add();

    doc.SetTitle("Example");
    TextState displayValueStyle = new TextState();
    displayValueStyle.ForegroundColor = Color.Black;
    displayValueStyle.Invisible = false;

    Table table_body = new Table();
    page.Paragraphs.Add(table_body);

    table_body.ColumnWidths = "40% 30% 30%";
    table_body.Border = new BorderInfo(BorderSide.Left | BorderSide.Top | BorderSide.Right, 1, Aspose.Pdf.Color.Black);

    // Create MarginInfo object and set its left, bottom, right and top margins
    MarginInfo margin = new MarginInfo();
    margin.Left = 5f;
    margin.Right = 5f;
    margin.Top = 5f;
    margin.Bottom = 5f;

    // Set the default cell padding to the MarginInfo object
    table_body.DefaultCellPadding = margin;
    TextState textState = new TextState();
    textState.FontStyle = FontStyles.Bold;

    //Add Table Header
    var row = table_body.Rows.Add();
    row.BackgroundColor = Color.Teal;
    row.Border = new BorderInfo(BorderSide.Bottom, 1, Aspose.Pdf.Color.Red);
    var cell = row.Cells.Add("Column One");
    cell.DefaultCellTextState = textState;
    cell.Border = new BorderInfo(BorderSide.Right, 1, Aspose.Pdf.Color.GreenYellow);
    cell = row.Cells.Add("Column Two");
    cell.DefaultCellTextState = textState;
    cell.Border = new BorderInfo(BorderSide.Right, 1, Aspose.Pdf.Color.Brown);
    cell = row.Cells.Add("Column Three");
    cell.DefaultCellTextState = textState;
    // This one wont work because the Row already has bottom line. I made this on purpose so you understand the how the border priority works
    cell.Border = new BorderInfo(BorderSide.Bottom, 1, Aspose.Pdf.Color.Black); 

    row = table_body.Rows.Add();
    row.Cells.Add("Value One").DefaultCellTextState = displayValueStyle;
    row.Cells.Add("Value Two").DefaultCellTextState = displayValueStyle;
    row.Cells.Add("Value Three").DefaultCellTextState = displayValueStyle;
    
    row = table_body.Rows.Add();
    row.Border = new BorderInfo(BorderSide.Bottom, 1, Aspose.Pdf.Color.Black);
    cell = row.Cells.Add("Value One and Two");
    cell.ColSpan= 2;
    row.Cells.Add("Value Three");
    
    doc.Save($"{PartialPath}_output.pdf");
}