Is there any control can read content and format of a word file?
Thanks,
Triet
15 Answers, 1 is accepted
Yes indeed, we just released a beta of RadRichTextBox that is able to edit and import/export DOCX and HTML documents:
http://www.telerik.com/products/silverlight/richtextbox.aspx
Here is a Demo:
http://demos.telerik.com/silverlight/beta/#RichTextBox/MSWord
Demo code:
http://www.telerik.com/community/forums/silverlight/richtextbox/telerik-richtextbox-demo.aspx
More info:
http://blogs.telerik.com/silverlightteam/posts/10-04-16/a_new_native_silverlight_4_rich_text_editor_coming_up.aspx
http://blogs.telerik.com/silverlightteam/posts/10-06-17/what_s_new_in_the_beta_of_radrichtextbox_for_silverlight.aspx
CTP Documentation:
http://www.telerik.com/help/silverlight/radrichtextbox-overview.html
Regards,
Mike
the Telerik team
That is amazing, I have one question: How do I save data from RadRich Textbox to the database?
Regards,
You can export the content of RadRichTxtBox in Xaml string and the store it wherever you may need:
private
void
SaveDocument_Click(
object
sender, RoutedEventArgs e)
{
IDocumentFormatProvider exporter =
new
XamlFormatProvider();
using
(MemoryStream stream =
new
MemoryStream())
{
exporter.Export(
this
.radRTB.Document, stream);
stream.Seek(0, SeekOrigin.Begin);
StreamReader reader =
new
StreamReader(stream);
documentContent = reader.ReadToEnd();
}
}
private
void
LoadDocument_Click(
object
sender, RoutedEventArgs e)
{
XamlFormatProvider provider =
new
XamlFormatProvider();
using
(MemoryStream stream =
new
MemoryStream())
{
StreamWriter writer =
new
StreamWriter(stream);
writer.Write(documentContent);
writer.Flush();
stream.Seek(0, SeekOrigin.Begin);
radRTB.Document = provider.Import(stream);
}
}
In this case documentContent string variable may be stored in a DB.
All the best,
Mike
the Telerik team
Could you provide me more detail about this sample (UI, code behind)?
Thanks
Please find attached a short example project which uses WCF RIA Services to store and load documents form database.
Note that this example uses the version of RadRichTextBox from the Q2 official release.
Alex
the Telerik team
But i use mvvm pattern, so i dont want to use code behind to bind data to RichTextBox.
How can i bind data from viewmodel?
Thanks in advand.
We will try to make a more complete example with RIA Services and Database for the Service Pack after a few weeks.
Meanwhile you can check this forum thread to see how to implement a wrapper or RadRichTextBox add a Dependency Property using the available format providers and then use binding.
I hope this is helpful!
Alex
the Telerik team
I have another question. I have a RadDocument. i can bind RadDocument to Richtextbox. but now i want change a word to a link.
I know the element hierarchy. RadDocument=>Section=>Paragraph=>Span & Hyperlink &InlineImage
now i have a span contain "ABCD" i want to change it to a Hyperlink "ABCD". when i add a new hyperlink, it appears at the end of paraghaph not at the position i want to, i can't remove the old span and replace a hyperlink.
how could i do that?
I have created a demo project for you, which replaces the current document selection or the word in which the caret currently is positioned with a hyperlink with the same text. If you need any further assistance, don't hesitate to contact us.
Sincerely yours,
Ivailo
the Telerik team
Thank you! This has helped my problem!
I have another question. I have a hyperlink on my Rich textbox. Hyperlink’s link will be showed when I mouse over that hyperlink, how could I modified that tooltip? Size, font, width ,remove text 'ctrl+click to folow...'…
Thanks for your question!
Currently the hyperlink customization is limited and the things you want to achieve are not doable now. I am adding this feature to out to-do list for the next version and we will ensure that such customization is possible. We will appreciate any thoughts about how do you expect this feature to behave.
Regards,
Vesko
the Telerik team
In your July 21st reply, you mentioned you would may be putting together another example after the SP1 release using the RichTextBox along with RIA Services and MVVM. I'm just curious if that is available.
Thanks!
Here is the updated sample that uses the new DataProvider components we introduced in Q2 SP1 which allow data binding. Note that the sample demonstrates how to use data binding with RadRichTextBox to load/store documents in a database, as we promised. This sample does not fully utilize the MVVM approach.
Let us know if this helped.
Greetings,
Mike
the Telerik team
I am using RadRichTextBox and I am looking for a way to set different Tooltips for Hyperlinks on a document.
I found a way to set the same tooltip for all Hyperlinks by using 'HyperlinkToolTipFormatString' property,
but what I need is set a different tooltip for each hyperlink.
Is this feature supported? if so how can I do this?
Thanks
Unfortunately this feature is still not available in RadRichTextBox. We will add it in our to-do list however it is hard for us to give you any specific time-frame for its availability. Hopefully it will be available for Q2. Is the meanwhile let us know if you have other suggestions or questions.
Kind regards,
Mike
the Telerik team