Table borders do not display in SfRichTextBoxAdv

Hi,

I am trying to add a table to a rich text box which has a 1px black border. I am using the following code sample, modified from the Syncfusion documentation: https://pastebin.com/gUec0a3b

When using the document created in the sample, the table appears in the rich text box and behave as expected, the only issue is there is no black table border! However, if I save the document as a Docx file, the table has the correct borders. So I suppose this suggests borders aren't rendering properly in SfRichTextBoxAdv?

Thanks,
Josh

3 Replies

PS Premkumar Sundaramoorthy Syncfusion Team February 25, 2020 07:34 AM UTC

Hi Josh,

Thank you for contacting Syncfusion support.

We can reproduce the issue with "Table borders are not rendered" in our end and suspect it to be a defect. We will validate this issue and update you with more details on 27th February 2020.

Please let us know if you have any questions.

Regards,
Premkumar
 



VA Vijayasurya Anandhan Syncfusion Team February 27, 2020 11:59 AM UTC

Hi Josh,

Thank you for your patience.

On further analyzing the code example, we found that you have missed setting LineWidth property of Border class. The default value of this property is 0, hence the border is not visible for the table in SfRichTextBoxAdv control. Please set the LineWidth property with the required value, to get table border visible.
 
 
Please try the following modified code example to add a table with a border visible. 
DocumentAdv document = new DocumentAdv(); 
SectionAdv section = new SectionAdv(); 
 
//Initializes border width as 0.5 points and converted to pixel units by multiplying (96 / 72). 
double borderWidth = (0.5) * (96 / 72); 
 
TableAdv table = new TableAdv(); 
 
TableFormat tableFormat = new TableFormat(); 
Borders borders = new Borders(); 
borders.Left = new Border() { Color = Colors.Black, LineStyle = LineStyle.Single, LineWidth = borderWidth }; 
borders.Right = new Border() { Color = Colors.Black, LineStyle = LineStyle.Single, LineWidth = borderWidth }; 
borders.Top = new Border() { Color = Colors.Black, LineStyle = LineStyle.Single, LineWidth = borderWidth }; 
borders.Bottom = new Border() { Color = Colors.Black, LineStyle = LineStyle.Single, LineWidth = borderWidth }; 
borders.Horizontal = new Border() { Color = Colors.Black, LineStyle = LineStyle.Single, LineWidth = borderWidth }; 
borders.Vertical = new Border() { Color = Colors.Black, LineStyle = LineStyle.Single, LineWidth = borderWidth }; 
tableFormat.Borders = borders; 
table.TableFormat = tableFormat; 
 
TableRowAdv row = new TableRowAdv(); 
TableCellAdv cell = new TableCellAdv(); 
ParagraphAdv paragraph = new ParagraphAdv(); 
SpanAdv span = new SpanAdv(); 
span.Text = "Hello World"; 
paragraph.Inlines.Add(span); 
cell.Blocks.Add(paragraph); 
row.Cells.Add(cell); 
table.Rows.Add(row); 
section.Blocks.Add(table); 
document.Sections.Add(section); 


Please let us know if you have any questions.

Regards,
Vijayasurya A
 



JO Josh February 27, 2020 05:46 PM UTC

Hi Vijayasurya,

The solution you provided has worked - many thanks!

Josh

Loader.
Up arrow icon