Hi,
When I set the text properties say to Bold in my RTB these are not saved to the DB. So when I re-load the RTB from the DB I get the text but not in Bold as I saved it.
Below is the code how I save and re-load the data from and to my RTB.
Fist my RTB.
<rad:RadRichTextBox Name="RTBReceiptFooter" IsReadOnly="False" DocumentContentChanged="TXTPropertyChanged_ReceiptFooter" DocumentInheritsDefaultStyleSettings="True" ShowFormattingSymbols="True" />
Here I grab the text from the RTB in the xaml.cs:
//Export Text
private void TXTPropertyChanged_ReceiptFooter(object sender, EventArgs e)
{
IDocumentFormatProvider exporter = new TxtFormatProvider();
using (MemoryStream stream = new MemoryStream())
{
exporter.Export(this.RTBReceiptFooter.Document, stream);
stream.Seek(0, SeekOrigin.Begin);
StreamReader reader = new StreamReader(stream);
_viewModel.MyText = reader.ReadToEnd();
}
}
Here I get the text from the db in the xaml.cs:
_LongDiscriptionSub = _viewModel.MyText;
public void ProvideSubText()
{
IDocumentFormatProvider provider = new TxtFormatProvider();
using (var stream = new MemoryStream())
{
var writer = new StreamWriter(stream);
writer.Write(_LongDiscriptionSub);
writer.Flush();
stream.Seek(0, SeekOrigin.Begin);
RTBReceiptFooter.Document = provider.Import(stream);
}
}
Thanky very much