This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.vb
54 lines (50 loc) · 2.07 KB
/
MainWindow.xaml.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Imports System
Imports System.Windows
#Region "#usings"
Imports DevExpress.Office.Services
Imports DevExpress.XtraRichEdit.API.Native
#End Region ' #usings
Namespace HTML_Export_ImageSourceExample
''' <summary>
''' Interaction logic for MainWindow.xaml
''' </summary>
Partial Public Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Private Sub richEditControl1_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
richEditControl1.CreateNewDocument()
richEditControl1.Document.Images.Append(DocumentImageSource.FromUri("http://www.devexpress.com/Support/Center/Attachment/GetAttachmentFile/e71fc07d-1c4e-4e08-a9be-65eb6f409c8b", Nothing))
embedImagesCheck.EditValue = True
AddHandler richEditControl1.ContentChanged, AddressOf richEditControl1_ContentChanged
End Sub
Private Sub richEditControl1_ContentChanged(ByVal sender As Object, ByVal e As EventArgs)
ReloadHtml()
End Sub
Private Sub ReloadHtml()
' #Region "#GetHtmlText"
Dim exportOptions As New DevExpress.XtraRichEdit.Export.HtmlDocumentExporterOptions()
exportOptions.EmbedImages = CBool(embedImagesCheck.IsChecked)
Dim sText As String = richEditControl1.Document.GetHtmlText(richEditControl1.Document.Range, New CustomUriProvider(), exportOptions)
' #End Region ' #GetHtmlText
memoEdit1.Text = sText
End Sub
#Region "#documentloaded"
Private Sub richEditControl1_DocumentLoaded(ByVal sender As Object, ByVal e As EventArgs)
Dim service As IUriProviderService = richEditControl1.GetService(Of IUriProviderService)()
If service IsNot Nothing Then
service.RegisterProvider(New CustomUriProvider())
End If
End Sub
#End Region ' #documentloaded
Private Sub embedImagesCheck_EditValueChanged(ByVal sender As Object, ByVal e As DevExpress.Xpf.Editors.EditValueChangedEventArgs)
If CBool(e.NewValue) = False Then
textBlock.Text = "The CustomUriProvider.CreateImageUri method is called to write the original image uri."
Else
textBlock.Text = "CustomUriProvider is idle."
End If
ReloadHtml()
End Sub
End Class
End Namespace