4 Answers, 1 is accepted
Thank you for writing.
Here is a sample code snippet demonstrating how to make the header text with capital letters:
public
Form1()
{
InitializeComponent();
this
.radRichTextEditor1.Text =
"Header"
+ Environment.NewLine +
"Sample text"
;
}
private
void
radButton1_Click(
object
sender, EventArgs e)
{
string
headerText =
"Header"
;
Telerik.WinForms.Documents.TextSearch.DocumentTextSearch search =
new
DocumentTextSearch(
this
.radRichTextEditor1.Document);
IEnumerable<TextRange> foundRanges = search.FindAll(headerText);
if
(headerText !=
string
.Empty)
{
foreach
(var textRange
in
foundRanges)
{
this
.radRichTextEditor1.Document.Selection.AddSelectionStart(textRange.StartPosition);
this
.radRichTextEditor1.Document.Selection.AddSelectionEnd(textRange.EndPosition);
string
selectedText =
this
.radRichTextEditor1.Document.Selection.GetSelectedText();
this
.radRichTextEditor1.ChangeFontSize(22);
this
.radRichTextEditor1.ToggleBold();
this
.radRichTextEditor1.ToggleItalic();
this
.radRichTextEditor1.Insert(selectedText.ToUpper());
}
}
}
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik
Hi,
What I want to do is to define a StyleDefinition that has "upper case" as its property.
I have a RadRichTextEditor and I have customized one of the styles as follows (document is MyRadRichTextEditor.Document):
string heading1StyleId = RadDocumentDefaultStyles.GetHeadingStyleNameByIndex(1);
document.StyleRepository.GetValueOrNull(heading1StyleId).SpanProperties.FontFamily = new Telerik.WinControls.RichTextEditor.UI.FontFamily("Arial");
document.StyleRepository.GetValueOrNull(heading1StyleId).SpanProperties.FontSize = Unit.PointToDip(16);
document.StyleRepository.GetValueOrNull(heading1StyleId).SpanProperties.ForeColor = Colors.Black;
document.StyleRepository.GetValueOrNull(heading1StyleId).ParagraphProperties.Background = Colors.White;
document.StyleRepository.GetValueOrNull(heading1StyleId).ParagraphProperties.SpacingBefore = 2.0;
And I want to define that the header, when choosing this header style, must be all in upper case.
Thank you for writing back.
Currently, RadRichTextEditor does not support functionality to change the selected text to lower/upper case. However, it is a reasonable request. I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.
I have also updated your Telerik points.
I hope this information helps. If you have any additional questions, please let me know.Regards,
Dess
Telerik
Thanks a lot for the info.
Shahrzade.