Free Support Forum - aspose.com

FIXED: Field Merging Callback Border Colors not working

It appears a default border weight of 1/2 pt is too thin to display a color. Increasing the border weight to 1.5 pt allowed the color to display.
______________________________

I am having an issue with setting border colors using the iFieldMergingCallback function. No matter what I set the color to, the resulting document either seems to set the borders to white or eliminate them:

The code I am using is as follows:

IF e.FieldName.Equals("someField") THEN
Dim table As Table = parentRow.ParentTable
For Each row As Row In table
For Each cell As Cell In row.Cells
cell.CellFormat.Borders.Color = Color.Red
Next
Next
END IF

I can see that it is changing the borders, so I know that the table and cell logic is correct. It's just not setting it to the actual color specified. I have attached a document with some screenshots of the results.


Hi David,


Thanks for your inquiry. Please use the following code snippet for your requirements. If you still face problem, please share your document for investigation purposes.

<span lang=“EN-GB” style=“font-family:“Courier New”;mso-no-proof:yes”> Dim doc As New Document(“D:\in.docx”)<o:p></o:p>

For Each table As Table In doc.GetChildNodes(NodeType.Table, True)

For Each row As Row In table.Rows

For Each cell As Cell In row.Cells

cell.CellFormat.Borders.Color = Color.Red

cell.CellFormat.Borders.LineWidth = 1.0

cell.CellFormat.Borders.LineStyle = LineStyle.Single

Next

Next

Next

doc.Save("D:\AsposeOut.docx")

Dim doc As New Document("D:\in.docx")

For Each table As Table In doc.GetChildNodes(NodeType.Table, True)

table.SetBorders(LineStyle.Single, 1.0, Color.Red);

Next

doc.Save("D:\AsposeOut.docx")