We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Table Cell Borders

Hi,
I am adding a Table in the document  that has the Default Borders (1 pt Solid).
On some rows I have 2 cells  and need to remove the internal borders of those cells.
I tried with this code:

= tbl.AddRow(false);
 r.HeightType = TableRowHeightType.AtLeast;
 r.Height = 20f;
 r.RowFormat.Borders.Bottom.BorderType = BorderStyle.None;
 r.RowFormat.Borders.Bottom.LineWidth = 0f;
 r.Cells.Clear();
 r.AddCell(false);
 r.AddCell(false);
 r.Cells[0].Width = 200f;
 r.Cells[1].Width = w - 200f;
 r.Cells[0].CellFormat.Borders.Right.BorderType = BorderStyle.None;
 r.Cells[0].CellFormat.Borders.Right.LineWidth = 0f;
 r.Cells[0].CellFormat.Borders.Bottom.BorderType = BorderStyle.None;
 r.Cells[0].CellFormat.Borders.Bottom.LineWidth = 0f;
 r.Cells[0].CellFormat.Borders.Top.BorderType = BorderStyle.None;
 r.Cells[0].CellFormat.Borders.Top.LineWidth = 0f;
 r.Cells[1].CellFormat.Borders.Left.BorderType = BorderStyle.None;
 r.Cells[1].CellFormat.Borders.Left.LineWidth = 0f;
 r.Cells[1].CellFormat.Borders.Bottom.BorderType = BorderStyle.None;
 r.Cells[1].CellFormat.Borders.Bottom.LineWidth = 0f;
 r.Cells[1].CellFormat.Borders.Top.BorderType = BorderStyle.None;
 r.Cells[1].CellFormat.Borders.Top.LineWidth = 0f;
I repeated this for some rows but the borders are present on those cells.
The same operation works with the property pages inside Word.
Have I done something wrong?
There is a workaround for this (I have not tried the conversion to pdf that will be the final format of the document generated).

    Thanks in advance

    Andrea Perazzolo
  





1 Reply

SK Sathish K Syncfusion Team September 29, 2015 02:10 PM UTC

Hi Andrea,

Thank you for contacting Syncfusion support.

Kindly defined the border style as “Cleared” instead of “None” which will clear the internal borders as expected. It will be working fine even in Word document to Pdf conversion also.

Code Example:
r.Cells[0].CellFormat.Borders.Left.BorderType = BorderStyle.Cleared;

r.Cells[0].CellFormat.Borders.Right.BorderType = BorderStyle.Cleared;

r.Cells[0].CellFormat.Borders.Top.BorderType = BorderStyle.Cleared;
r.Cells[0].CellFormat.Borders.Bottom.BorderType = BorderStyle.Cleared;

Regards,
Sathish


Loader.
Live Chat Icon For mobile
Up arrow icon