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


    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();                                     
     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=""""
                         version=""1.2"" LayoutMode=""Flow"" LineSpacing=""1.15"" LineSpacingType=""Auto"" ParagraphDefaultSpacingAfter=""12""
                         ParagraphDefaultSpacingBefore=""0"" SectionDefaultPageSize=""816,1056"">
                              <t:Span ForeColor=""Red"" Text=""testing"" />
                              <t:Span ForeColor=""Blue"" Text=""testing"" />
                              <t:Span ForeColor=""Green"" Text=""testing"" />
    how to get testing string from above raddocument paragraphs.... please advise...its very imp and urgent
  2. Answer
    Petya avatar
    973 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.
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
Back to Top