Appen Text at the end of a document

2 posts, 0 answers
  1. francesco
    francesco avatar
    8 posts
    Member since:
    Sep 2008

    Posted 25 Feb 2012 Link to this post

    Does anyone trying to append programmatically some text at the end of an existing RadDocument?

    This part of code doesen't works well:

    Telerik.WinControls.RichTextBox.FormatProviders.IDocumentFormatProvider p = new Telerik.WinControls.RichTextBox.FileFormats.Html.HtmlFormatProvider();
    Telerik.WinControls.RichTextBox.Model.RadDocument document = p.Import(System.Text.Encoding.UTF8.GetBytes(pBody));
    document.Insert(pNote, style);
    The text was appended at the end of the first word of the document.
    Anyone could help me?

  2. Stefan
    Stefan avatar
    2891 posts

    Posted 28 Feb 2012 Link to this post

    Hi Francesco,

    Thank you for writing.

    In your code you are instantiating a provider (named document) and trying to insert a text in it. The correct approach is to have the import the context via the provider to a document and then use the document to add your text. Attached you can find a sample application demonstrating this approach. 

    I hope that you find this information useful. Let me know if I can be of further assistance. 
    Kind regards,
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. DevCraft R3 2016 release webinar banner
Back to Top