Inserting into a RadDocument

4 posts, 0 answers
  1. Martin
    Martin avatar
    17 posts
    Member since:
    May 2014

    Posted 21 May 2014 Link to this post

    I know how to merge RadDocuments, but I'm trying to insert into a RadDocument which is acting as a template. How would I go about inserting the following XAML into a RadDocument?

    <t:Paragraph FontSize="13.333333" LineSpacing="1" SpacingAfter="12"><t:Span FontFamily="Verdana" FontSize="13.333333" Text="Lorem ipsum dolor sit amet" /></t:Paragraph>

    The above XAML comes from a RadRichTextBox and should be inserted into the RadDocument when exporting. It seems like the DocumentFragment class used to have this functionality (http://www.telerik.com/forums/loading-multiple-raddocuments-into-a-richtextbox), but it no longer takes in a Document in the constructor. It might be possible to do the above in an actual RichTextBox, but I'd like to do it using the RadDocument if possible.



  2. George
    Admin
    George avatar
    500 posts

    Posted 23 May 2014 Link to this post

    Hi Martin,

    Thank you for contacting us.

    RadDocument has a method called Insert which is used exactly for this purpose. As far as I can tell from the description provided, it will be sufficient for your needs. For example, here is how to create a RadDocument containing the word "Text":
    RadDocument doc = new RadDocument();
    doc.Insert("Text", new StyleDefinition());

    You can then use it to associate it with a RadRichTextBox or merge it with other documents.

    Let me know if you have other questions.

    Regards,
    George
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Martin
    Martin avatar
    17 posts
    Member since:
    May 2014

    Posted 30 May 2014 in reply to George Link to this post

    Insert(string text, StyleDefinition style) is obsolete. The obsolete comment references InsertInline, which is also obsolete. So that is not doable.

    Basically what I've got is a RichTextBox where in a user can enter information. I then want to generate a PDF where this information (with formatting) is in its own TableCell. Is this possible or would I have to user another component? I've switched to WPF if that makes it easier.

            [Obsolete("Use RadDocumentEditor.InsertInline method instead.")]
            public void Insert(string text, StyleDefinition style);

            [Obsolete("Use RadDocumentEditor.InsertInline method instead.")]
            public void InsertInline(Inline inline);

            [Obsolete("This method is deprecated.")]
            public void InsertInline(Inline inline, DocumentPosition position);




  5. George
    Admin
    George avatar
    500 posts

    Posted 04 Jun 2014 Link to this post

    Hi Martin,

    Thank you for replying.

    It seems that you are using UI for WPF, since this method is not obsolete in our UI for WinForms suite. Since your questions are no longer concerning WinForms I would suggest you to submit your question in the appropriate forums: UI for WPF Forums.

    Let me know if you have further questions regarding UI for WinForms.

    Regards,
    George
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top