The TableCellProperty.Padding property of the "TableNormal" StyleDefinition doesn't take effect in the UI. The same is valid for the TableProperties.CellPadding property.
To work this around, you can manually set the Padding property of all TableCell elements in the RadDocument.
var cells = radDocument.EnumerateChildrenOfType<Telerik.Windows.Documents.Model.TableCell>();
foreach (var cell in cells)
{
cell.Padding = new Padding(10);
}
The settings from the style definition do not take effect only when there are default values in the rtf document that take precedence. In this specific case, the Padding value of the TableCellProperties will not take effect when the table cells in the rtf document have a padding specified. For example in the following scenario, where the table cells in the rtf do not have a padding applied:
string testRtf = @"{\rtf1\ansi\deff0 {\fonttbl {\f0 Times New Roman;}}
{
\trowd \trgaph180
\cellx1440\cellx2880
\pard\intbl {Fee.}\cell
\pard\intbl {Fie.}\cell
\row
}{
\trowd \trgaph180
\cellx1440\cellx2880
\pard\intbl {Foe.}\cell
\pard\intbl {Fum.}\cell
\row
}
}";
RtfFormatProvider rtfProvider = new RtfFormatProvider();
RadDocument radDocument = rtfProvider.Import(testRtf);
Telerik.Windows.Documents.Model.Styles.StyleDefinition tableStyle = radDocument.StyleRepository.GetValueOrNull(RadDocumentDefaultStyles.DefaultNormalTableStyleName);
tableStyle.TableCellProperties.Padding = new Padding(30);
RichText.Document = radDocument;
the Padding set to TableCellProperties property is correctly applied to the table cells when displayed in the RadRichTextBox.
Regards,
Vladimir Stoyanov
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.