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

Inserting into a RadDocument

3 Answers 53 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 21 May 2014, 08:18 AM
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.



3 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 23 May 2014, 02:14 PM
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.
 
0
Martin
Top achievements
Rank 1
answered on 30 May 2014, 12:28 PM
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);




0
George
Telerik team
answered on 04 Jun 2014, 12:56 PM
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.
 
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Martin
Top achievements
Rank 1
Answers by
George
Telerik team
Martin
Top achievements
Rank 1
Share this question
or