This is a migrated thread and some comments may be shown as answers.

Get Content from RadDocument

1 Answer 556 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Rama
Top achievements
Rank 1
Rama asked on 29 Oct 2012, 05:28 AM
Hi,

I converted string to RadDocument manually.

How can i get back my string back from raddocument.

I am using value converters to do this.

here is the sample code. please help me and thanks in advance

raddocument doc = new raddocument();                                     
XamlFormatProvider
 provider = new XamlFormatProvider(); doc = provider.Import(value.ToString()); foreach (Paragraph paragraph in doc.EnumerateChildrenOfType<Paragraph>()) {  //paragraph.Inlines  foreach(Inline line in paragraph.Inlines)  {        } }

In other words:

If i have my raddoucment as

string raddocstring =  "<t:RadDocument xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
                     xmlns:t=""clr-namespace:Telerik.Windows.Documents.Model;assembly=Telerik.Windows.Documents""
                     xmlns:s=""clr-namespace:Telerik.Windows.Documents.Model.Styles;assembly=Telerik.Windows.Documents""
                     version=""1.2"" LayoutMode=""Flow"" LineSpacing=""1.15"" LineSpacingType=""Auto"" ParagraphDefaultSpacingAfter=""12""
                     ParagraphDefaultSpacingBefore=""0"" SectionDefaultPageSize=""816,1056"">
                     <t:Section>
                        <t:Paragraph>
                          <t:Span ForeColor=""Red"" Text=""testing"" />
                          <t:Span ForeColor=""Blue"" Text=""testing"" />
                          <t:Span ForeColor=""Green"" Text=""testing"" />
                        </t:Paragraph>
                     </t:Section>
                     </t:RadDocument>";
how to get testing string from above raddocument paragraphs.... please advise...its very imp and urgent
 

1 Answer, 1 is accepted

Sort by
0
Accepted
Petya
Telerik team
answered on 30 Oct 2012, 07:44 AM
Hi Rama,

You can export RadDocument to string as follows:
XamlFormatProvider provider = new XamlFormatProvider();
string myXamlString = provider.Export(doc);
Here doc is the name of your RadDocument instance.

If you need further information regarding export and import, you can refer to this help article

Feel free to contact us again if you need additional help.
 
Greetings,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Rama
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or