Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.
Wed Apr 25, 2018 9:10 pm
Hi, i think function TableRow.RowFormat.Borders.Top.BorderType = BorderStyle.Single is not working.
last row should has top border as Single Line.
please look attach.
private Spire.Doc.Document SPD;
Table table = new Table(this.SPD, false);
TableRow row = table.AddRow(3);
row.RowFormat.Borders.Top.BorderType = BorderStyle.Single;
table.TableFormat.Borders.Top.BorderType = BorderStyle.Single;
table.TableFormat.Borders.Bottom.BorderType = BorderStyle.Double;
table.TableFormat.Borders.Left.BorderType = BorderStyle.Single;
table.TableFormat.Borders.Right.BorderType = BorderStyle.Single;
Login to view the files attached to this post.
-
sserra
-
- Posts: 76
- Joined: Tue Jun 13, 2017 4:03 pm
Thu Apr 26, 2018 2:23 am
Hello,
Thanks for your post. Actually, it is not available to set border style of a single row directly, you need to set each cell of the row instead. Please refer to the below code snippet.
- Code: Select all
Document doc = new Document();
doc.LoadFromFile(@"test.docx");
// Table table = new Table(doc, false);
Table table = doc.Sections[0].Tables[0] as Table;
TableRow row = table.AddRow(3);
foreach (TableCell cell in row.Cells)
{
cell.CellFormat.Borders.Top.BorderType = BorderStyle.Single;
}
table.TableFormat.Borders.Top.BorderType = BorderStyle.Single;
table.TableFormat.Borders.Bottom.BorderType = BorderStyle.Double;
table.TableFormat.Borders.Left.BorderType = BorderStyle.Single;
table.TableFormat.Borders.Right.BorderType = BorderStyle.Single;
Best regards,
Simon
E-iceblue support team
-
Simon.yang
-
- Posts: 620
- Joined: Wed Jan 11, 2017 2:03 am
Thu Apr 26, 2018 2:42 pm
Hi ,
thank you for help.
but if your Spire.Doc library has row.RowFormat.Borders.Top.BorderType = BorderStyle.Single;
it is mean available.
-
sserra
-
- Posts: 76
- Joined: Tue Jun 13, 2017 4:03 pm
Fri Apr 27, 2018 1:59 am
Hello,
Thanks for your prompt reply. As following the rules of MS Word, it's not available to set the border style of a table row directly. In addition, the property of BorderStyle under the RowFormat can't be removed in our library, because RowFormat is a reuse Class. We will add annotations under it to avoid the misuse.
Best regards,
Simon
E-iceblue support team
-
Simon.yang
-
- Posts: 620
- Joined: Wed Jan 11, 2017 2:03 am