Hello,
I have a problem with using of Dash property in a cell in a table.
Below my sample code:
Private Sub TestTableWithCellDashSide() Dim pdf = New Document() Dim page = pdf.Pages.Add() 'Table definition Dim table1 = New Table table1.ColumnWidths = "150 100 100" table1.DefaultCellBorder = New BorderInfo(BorderSide.Box, 0.1) table1.Border = New BorderInfo(BorderSide.Box, 3) Dim margin = New MarginInfo() margin.Top = 3 margin.Left = 3 margin.Right = 3 margin.Bottom = 3 table1.DefaultCellPadding = margin page.Paragraphs.Add(table1) 'add 1 row with 3 standards cells Dim row = AddRow(table1) row.Cells.Add("cell (1,1)") row.Cells.Add("cell (1,2)") row.Cells.Add("cell (1,3)") 'add 2nd row with 3 cells ; 1st cell add solid vertical right (graphinfo) row = AddRow(table1) Dim cell = row.Cells.Add("cell (2,1) // With solid vertical") VerticalCell(cell, Nothing, Aspose.Pdf.Color.FromArgb(192, 0, 0)) row.Cells.Add("cell (2,2)") row.Cells.Add("cell (2,3)") 'add 3th row with 3 cells ; 1st cell add DASH vertical right (graphinfo) row = AddRow(table1) Dim newCell = row.Cells.Add("cell (3,1) // With DASH vertical") VerticalCell(newCell, {0, 3, 0}, Aspose.Pdf.Color.FromArgb(0, 160, 0)) row.Cells.Add("cell (3,2)") row.Cells.Add("cell (3,3)") 'add 4th row with 3 cells ; 1st cell add solid vertical right (graphinfo) row = AddRow(table1) cell = row.Cells.Add("cell (4,1) // With solid vertical") VerticalCell(cell, Nothing, Aspose.Pdf.Color.FromArgb(192, 0, 0)) row.Cells.Add("cell (4,2)") row.Cells.Add("cell (4,3)") 'add 5th row with 3 standards cells row = AddRow(table1) row.Cells.Add("cell (5,1)") row.Cells.Add("cell (5,2)") row.Cells.Add("cell (5,3)") pdf.Save($"C:\temp\testAposePdfDashTable.pdf") Process.Start($"C:\temp\testAposePdfDashTable.pdf") End Sub Private Sub VerticalCell(cell As Cell, dash As Integer(), couleur As Aspose.Pdf.Color) Dim gi = New GraphInfo() gi.LineWidth = 2 If dash Is Nothing Then gi.DashArray = Nothing gi.DashPhase = 0 Else gi.DashArray = dash gi.DashPhase = 1 End If gi.Color = couleur cell.Border = New BorderInfo(BorderSide.Right, gi) End Sub Private Function AddRow(tb As Table) As Row Dim row = tb.Rows.Add() row.FixedRowHeight = 25 row.Border = New BorderInfo(BorderSide.Box, 1, Aspose.Pdf.Color.DarkGray) Return row End Function
The resulting PDF file is here : testAposePdfDashTable.pdf (2.7 KB)
As you can see it’s very strange because as soon as I apply dash pattern on vertical side on my cell, all the following borders (cells, tables, rows) become dash border. I expect that only vertical green side of my cell (3,1) is using dash pattern, not the others…
If I add a second new table, this one use dash border too.
Could you help me, please ?