Get Content from RadDocument

2 posts, 1 answers
  1. Rama
    Rama avatar
    8 posts
    Member since:
    Sep 2012

    Posted 29 Oct 2012 Link to this post

    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
     
  2. Answer
    Petya
    Admin
    Petya avatar
    975 posts

    Posted 30 Oct 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top