We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Each table row having bottom border only

Hello:
I can create a table and put borders around each cell, but what I'm really wanting to do is to only have each table row have a border. My temp work around is to,

* start a table
* put a bottom border on the table row
* end the table
* insert a paragraph break
* start new table.... repeat.....

I realize this is not ideal, but cannot figure out to just put the bottom border on each interior row. I initially tried a path of,

Borders borders = builder.RowFormat.Borders;
borders[BorderType.Right].LineStyle = LineStyle.None;
borders[BorderType.Left].LineStyle = LineStyle.None;
borders[BorderType.Top].LineStyle = LineStyle.None;

borders[BorderType.Bottom].LineStyle = LineStyle.Single;
borders[BorderType.Bottom].LineWidth = 2;
borders[BorderType.Bottom].Color = System.Drawing.Color.Black;

but that did not work. Can you provide guidance on how to just put a border on each row in a table?

Thanks,
Ed

Hi

Thanks for your inquiry. I think that you can try using the following code.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.CellFormat.Borders[BorderType.Bottom].LineStyle = LineStyle.Single;

builder.CellFormat.Borders[BorderType.Bottom].Color = Color.Red;

builder.CellFormat.Borders[BorderType.Bottom].LineWidth = 2;

builder.CellFormat.Width = 50;

for (int i = 0; i < 10; i++)

{

for (int j = 0; j < 5; j++)

{

builder.InsertCell();

}

builder.EndRow();

}

builder.EndTable();

doc.Save("out.doc");

Best regards.