Hey there,
I am having troubles rerendering/reloading/reimporting the fixed/preferred width of a table within the RichTextBox:
Here is how I insert my table:
This works fine. The RichTextBox control inserts the table with the preferred width. The HTML code it creates after exporting is:
Rendering it in any browser also works fine. The table's width is still 200.
However, if I try to import that HTML into the RichTextBox control again:
The RichTextBox control renders the table with auto-fit style, means the table's fixed width 200 renders incorrectly.
Am I doing anything wrong in the import call or is this a bug in the control?
Thanks,
Jean
I am having troubles rerendering/reloading/reimporting the fixed/preferred width of a table within the RichTextBox:
Here is how I insert my table:
var table = new Table { Borders = new TableBorders(new Border(1, Telerik.WinControls.RichTextBox.Model.BorderStyle.Single, Color.Black)), LayoutMode = TableLayoutMode.Fixed, PreferredWidth = new TableWidthUnit(200) }; for (int i = 0; i < 2; i++) { var row = new TableRow(); for (int j = 0; j < 2; j++) { var cell = new TableCell { Background = Color.White, Padding = new Padding(3) }; var paragraph = new Paragraph(); var span = new Span { Text = "c"+ i + j }; paragraph.Inlines.Add(span); cell.Blocks.Add(paragraph); row.Cells.Add(cell); } table.Rows.Add(row); } this.richTextBox.InsertTable(table);
This works fine. The RichTextBox control inserts the table with the preferred width. The HTML code it creates after exporting is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled</title> <style type="text/css"> .p_384D933F { margin: 0px 0px 0px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px; } .s_6BF1D20F { font-family: 'Calibri';font-style: normal;font-size: 16px;color: #000000; } .p_CC664AAA { margin: 0px 0px 12px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px; } .tbl_77AF2C2D { border-collapse: collapse;table-layout: fixed;width: 200px; } .tc_C0034B80 { border-left: 1px solid #000000;border-top: 1px solid #000000;border-right: 1px solid #000000;border-bottom: 1px solid #000000;padding: 3px 3px 3px 3px;background-color: #FFFFFF;vertical-align: top; } </style> </head> <body> <p class="p_384D933F"><span class="s_6BF1D20F"> </span></p> <table class="tbl_77AF2C2D"> <tr> <td class="tc_C0034B80" align="left" valign="top"> <p class="p_CC664AAA"><span class="s_6BF1D20F">c00</span></p> </td> <td class="tc_C0034B80" align="left" valign="top"> <p class="p_CC664AAA"><span class="s_6BF1D20F">c01</span></p> </td> </tr> <tr> <td class="tc_C0034B80" align="left" valign="top"> <p class="p_CC664AAA"><span class="s_6BF1D20F">c10</span></p> </td> <td class="tc_C0034B80" align="left" valign="top"> <p class="p_CC664AAA"><span class="s_6BF1D20F">c11</span></p> </td> </tr> </table> <p class="p_384D933F"><span class="s_6BF1D20F"> </span></p> </body></html>Rendering it in any browser also works fine. The table's width is still 200.
However, if I try to import that HTML into the RichTextBox control again:
IDocumentFormatProvider provider = new HtmlFormatProvider(); Byte[] convertedText = Encoding.ASCII.GetBytes(htmlStream); RadDocument document = provider.Import(convertedText); richTextBox.Document = document;The RichTextBox control renders the table with auto-fit style, means the table's fixed width 200 renders incorrectly.
Am I doing anything wrong in the import call or is this a bug in the control?
Thanks,
Jean