This question is locked. New answers and comments are not allowed.
Hi,
I'm making a Word application, and I need export a text in string when the user enter text in the RichTextBox, in html and txt, when the user save this document. I've been looking at different posts of the forum, and I don't get a string with the plain text format. I'm using -Telerik.Windows.Documents.FormatProviders.Txt-, as I have seen in other post (http://www.telerik.com/community/forums/silverlight/richtextbox/how-to-validate-there-is-no-text-in-richtextbox.aspx):
But if this is correct, I can't recognize me ITextBasedDocumentFormatProvider interface, and therefore not get the plain text. I'm doing something wrong or I need some assembly?
On the other hand, to export the text in html conducted the following method:
Is it right?
Thank you for your attention.
I'm making a Word application, and I need export a text in string when the user enter text in the RichTextBox, in html and txt, when the user save this document. I've been looking at different posts of the forum, and I don't get a string with the plain text format. I'm using -Telerik.Windows.Documents.FormatProviders.Txt-, as I have seen in other post (http://www.telerik.com/community/forums/silverlight/richtextbox/how-to-validate-there-is-no-text-in-richtextbox.aspx):
ITextBasedDocumentFormatProvider exporter =
new
TxtFormatProvider();
string
text = exporter.Export (document);
But if this is correct, I can't recognize me ITextBasedDocumentFormatProvider interface, and therefore not get the plain text. I'm doing something wrong or I need some assembly?
On the other hand, to export the text in html conducted the following method:
public
string
ExportToHtml(RadDocument document)
{
IDocumentFormatProvider provider =
new
HtmlFormatProvider();
string
exportValue = String.Empty;
using
(MemoryStream output =
new
MemoryStream())
{
provider.Export(document, output);
output.Seek(0, SeekOrigin.Begin);
using
(StreamReader reader =
new
StreamReader(output))
{
exportValue = reader.ReadToEnd();
}
}
return
exportValue;
}
Is it right?
Thank you for your attention.