Public Property Rtf As System.String Get Dim currentFormat As RichTextEdit.DocumentFormats = Me._format Try Me.Format = DocumentFormats.Rtf Using ms As System.IO.MemoryStream = Me.Stream Return _encoding.GetString(ms.ToArray) End Using Finally Me.Format = currentFormat End Try End Get Set(value As System.String) Dim currentFormat As RichTextEdit.DocumentFormats = Me._format Try Me.Format = RichTextEdit.DocumentFormats.Rtf Using ms As New System.IO.MemoryStream(_encoding.GetBytes(value)) Me.Stream = ms End Using Finally Me.Format = currentFormat End Try End Set End Property Public Property Stream As System.IO.MemoryStream Get Dim richTextView As Nevron.Nov.Text.NRichTextView = Me._currentView If richTextView IsNot Nothing Then Dim currentLayout As Nevron.Nov.Text.ENTextLayout = richTextView.Content.Layout Try richTextView.Content.Layout = Me._currentLayout Dim MS As New System.IO.MemoryStream richTextView.Document.Evaluate() If Me.Format = DocumentFormats.Html Then 'Use inline styles because Outlook doesn't handle css well. Dim saveSettings As New Nevron.Nov.Text.Formats.Html.NHtmlSaveSettings saveSettings.InlineStyles = True richTextView.SaveToStream(MS, Me.DocumentFormat, saveSettings) Else richTextView.SaveToStream(MS, Me.DocumentFormat) End If Return MS Finally richTextView.Content.Layout = currentLayout End Try End If Return Nothing End Get Set(value As System.IO.MemoryStream) If value IsNot Nothing Then Dim richTextView As Nevron.Nov.Text.NRichTextView = Me._currentView If richTextView IsNot Nothing Then richTextView.Content.Sections.Clear() richTextView.LoadFromStream(value, Me.DocumentFormat) Me._currentLayout = richTextView.Content.Layout If Me._navigation = NavigationView.None Then 'When displaying the plain control, display the contents in web view so scrollbars, etc. work properly. richTextView.Content.Layout = Nevron.Nov.Text.ENTextLayout.Web End If End If End If End Set End Property