The problem is that there is everything is printed on the same line and the LineBreake itself i replaced by two Squares (i asume that is since the LineBreak character is not recognized).
I have tried replacing the LineBreak with "FormattingSymbolLayoutBox.LINE_BREAK", but the text is still on one line and I get a ¬ character instead of the two Squares.
Is it impossible to insert a LineBreak inside a Span, or is it possible to fix this?
Please note that I am only using the RadDocument class and that I am not and do not want to use the actual RichTextBox Control!
8 Answers, 1 is accepted
Generally, a span that contains "\n" in it is considered invalid, so you shouldn't be using this method when creating your document. The proper way to add a line break would be the second approach you mentioned - inserting FormattingSymbolLayoutBox.LINE_BREAK. The ¬ character, on the other hand, is the symbol used for adding line breaks in the document.
So, a correctly structured document would look something like this:
RadDocument document=
new
RadDocument();
Section section =
new
Section();
Paragraph paragraph1 =
new
Paragraph();
Span span1 =
new
Span(
"Some text in the first span. "
);
paragraph1.Inlines.Add(span1);
paragraph1.Inlines.Add(
new
Span(FormattingSymbolLayoutBox.LINE_BREAK));
Span span2 =
new
Span(
"Some more text after the line break in the same paragraph."
);
paragraph1.Inlines.Add(span2);
Paragraph paragraph2 =
new
Paragraph();
Span span3=
new
Span(
"Last paragraph"
);
paragraph2.Inlines.Add(span3);
section.Blocks.Add(paragraph1);
section.Blocks.Add(paragraph2);
document.Sections.Add(section);
I also tried exporting to PDF the document above and it all looks good on my end. Can you please verify that and contact us again if you are observing different behavior?
Let me know how it goes.
Greetings,
Petya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Using FormattingSymbolLayoutBox.LINE_BREAK within a Span worked for us until we recently upgraded to version 2015.1.401.45. Now our document literally displays the ¬ symbol. Please help!
pragraph.Inlines.Add(new Span(FormattingSymbolLayoutBox.LINE_BREAK + "Some more text after the line break in the same paragraph");
In Q1 2015 we introduced a new Break element into the model of RadDocument. With the current version of RadRichTextBox, if you insert a line break symbol ("¬") or a page break symbol ("◊"), a break will not be inserted in the document. You can use the Break class, which is described in our documentation.
All the changes introduced in our controls are listed in the Changes and Backward Compatibility section for the control.
Hope this helps.
Regards,
Tanya
Telerik
See What's Next in App Development. Register for TelerikNEXT.


Hi Petya's'
i am trying to add a section break in a specific location. First i add a "[Section Break]" and after that i try to replace it with a section break.i added my code here. please give me a way to do that. i added page break this way but i cant do that for section break.
Could you elaborate a bit more on the scenario you are working on? The screenshot of your code is not enough to fully replicate the case. Please have in mind that Sections are positioned above Paragraphs in document's Element Hierarchy. This is why the same approach working for inserting Page Breaks might not work for inserting Section Breaks.A sample project illustrating both approaches you are working on will help in isolating the issue.
In the meantime the code below shows a possible approach to insert a Section Break using RadRichTextBox' Search functionality.
this
.radRichTextBox.Document.Selection.Clear();
// this clears the selection before processing
DocumentTextSearch search =
new
DocumentTextSearch(
this
.radRichTextBox.Document);
foreach
(var textRange
in
search.FindAll(
"\\[Section Break\\]"
))
{
this
.radRichTextBox.Document.Selection.AddSelectionStart(textRange.StartPosition);
this
.radRichTextBox.Document.Selection.AddSelectionEnd(textRange.EndPosition);
}
this
.radRichTextBox.InsertSectionBreak(SectionBreakType.Continuous);
Hope this helps.
Regards,
Peshito
Progress Telerik

Hi Peshito,
Thanks for your reply. currently we are using radeditor(asp.net ajax) and we use radflowdocument to generate to word. please tell me a way to do this using radflowdocument.
Could you please open a separate support thread in WordsProcessing forum? I can see that you already initiated a discussion here, if this is sufficient, we can continue the conversation there.
Regards,
Boby
Progress Telerik