DocumentViewer back to richtextedit

This commit is contained in:
Developer01 2025-07-18 15:43:21 +02:00
parent 7816f7ff8a
commit 87b442d896
5 changed files with 43 additions and 24 deletions

View File

@ -63,6 +63,7 @@ Partial Class DocumentViewer
Me.SpreadsheetControl1 = New DevExpress.XtraSpreadsheet.SpreadsheetControl()
Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument()
Me.lbFileNotLoaded = New DevExpress.XtraEditors.LabelControl()
Me.RichEditControl1 = New DevExpress.XtraRichEdit.RichEditControl()
CType(Me.BarManager1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.RepositoryItemTextEdit2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.RepositoryItemTextEdit3, System.ComponentModel.ISupportInitialize).BeginInit()
@ -450,10 +451,20 @@ Partial Class DocumentViewer
Me.lbFileNotLoaded.Text = "Die Datei konnte nicht geladen werden"
Me.lbFileNotLoaded.Visible = False
'
'RichEditControl1
'
Me.RichEditControl1.Location = New System.Drawing.Point(571, 238)
Me.RichEditControl1.MenuManager = Me.BarManager1
Me.RichEditControl1.Name = "RichEditControl1"
Me.RichEditControl1.Size = New System.Drawing.Size(400, 200)
Me.RichEditControl1.TabIndex = 5
Me.RichEditControl1.Visible = False
'
'DocumentViewer
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Controls.Add(Me.RichEditControl1)
Me.Controls.Add(Me.lbFileNotLoaded)
Me.Controls.Add(Me.SpreadsheetControl1)
Me.Controls.Add(Me.GdViewer)
@ -514,4 +525,5 @@ Partial Class DocumentViewer
Friend WithEvents lbFileNotLoaded As DevExpress.XtraEditors.LabelControl
Friend WithEvents btnSearch As DevExpress.XtraBars.BarButtonItem
Friend WithEvents btnSearch2 As DevExpress.XtraBars.BarButtonItem
Friend WithEvents RichEditControl1 As DevExpress.XtraRichEdit.RichEditControl
End Class

View File

@ -23,6 +23,7 @@ Public Class DocumentViewer
Private Enum ViewerMode
GDPicture
Excel
Richtext
End Enum
Private Enum FileLoadMode
@ -124,8 +125,6 @@ Public Class DocumentViewer
''' </summary>
Public Sub LoadFile(FilePath As String)
FileLoaded = False
we
If _licenseKey = String.Empty Then
_logger.Warn("License key was not provided. File {0} not loaded.", FilePath)
Exit Sub
@ -442,6 +441,8 @@ Public Class DocumentViewer
Select Case Extension.ToUpper
Case "CSV"
_ViewerMode = ViewerMode.Excel
Case ".EML", ".DOC", ".DOCX", ".ODT", ".RTF", ".TXT"
_ViewerMode = ViewerMode.RichText
Case Else
_ViewerMode = ViewerMode.GDPicture
End Select
@ -472,7 +473,9 @@ Public Class DocumentViewer
lbFileNotLoaded.Visible = False
SpreadsheetControl1.Visible = False
RichEditControl1.Visible = False
SpreadsheetControl1.Dock = DockStyle.None
RichEditControl1.Dock = DockStyle.None
Select Case oExtension.ToUpper
Case ".CSV"
@ -484,7 +487,11 @@ Public Class DocumentViewer
SpreadsheetControl1.Visible = True
SpreadsheetControl1.Dock = DockStyle.Fill
Case ".EML", ".DOC", ".DOCX", ".ODT", ".RTF", ".TXT"
RichEditControl1.LoadDocument(FilePath, GetDocumentFormat(oExtension))
RichEditControl1.Visible = True
RichEditControl1.Dock = DockStyle.Fill
Case Else
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.0.1.0")>
<Assembly: AssemblyVersion("2.0.2.0")>
<Assembly: AssemblyFileVersion("2.0.1.0")>

View File

@ -1,9 +1,9 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmDocView
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
@ -20,7 +20,7 @@ Partial Class frmDocView
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.Button2 = New System.Windows.Forms.Button()
@ -28,7 +28,7 @@ Partial Class frmDocView
Me.Button4 = New System.Windows.Forms.Button()
Me.Button3 = New System.Windows.Forms.Button()
Me.Button1 = New System.Windows.Forms.Button()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.txtfilepath = New System.Windows.Forms.TextBox()
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
Me.MyDocumentViewer = New DigitalData.Controls.DocumentViewer.DocumentViewer()
Me.Panel1.SuspendLayout()
@ -41,7 +41,7 @@ Partial Class frmDocView
Me.Panel1.Controls.Add(Me.Button4)
Me.Panel1.Controls.Add(Me.Button3)
Me.Panel1.Controls.Add(Me.Button1)
Me.Panel1.Controls.Add(Me.TextBox1)
Me.Panel1.Controls.Add(Me.txtfilepath)
Me.Panel1.Dock = System.Windows.Forms.DockStyle.Top
Me.Panel1.Location = New System.Drawing.Point(0, 0)
Me.Panel1.Name = "Panel1"
@ -93,25 +93,25 @@ Partial Class frmDocView
Me.Button1.Text = "Open File"
Me.Button1.UseVisualStyleBackColor = True
'
'TextBox1
'txtfilepath
'
Me.TextBox1.Location = New System.Drawing.Point(12, 12)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(524, 20)
Me.TextBox1.TabIndex = 0
Me.txtfilepath.Location = New System.Drawing.Point(12, 12)
Me.txtfilepath.Name = "txtfilepath"
Me.txtfilepath.Size = New System.Drawing.Size(524, 20)
Me.txtfilepath.TabIndex = 0
'
'OpenFileDialog1
'
Me.OpenFileDialog1.FileName = "OpenFileDialog1"
'
'DocumentViewer1
'MyDocumentViewer
'
Me.MyDocumentViewer.Dock = System.Windows.Forms.DockStyle.Fill
Me.MyDocumentViewer.FileLoaded = False
Me.MyDocumentViewer.Location = New System.Drawing.Point(0, 43)
Me.MyDocumentViewer.Name = "DocumentViewer1"
Me.MyDocumentViewer.Name = "MyDocumentViewer"
Me.MyDocumentViewer.Size = New System.Drawing.Size(1079, 463)
Me.MyDocumentViewer.TabIndex = 0
Me.MyDocumentViewer.TabIndex = 2
'
'frmDocView
'
@ -127,14 +127,13 @@ Partial Class frmDocView
Me.ResumeLayout(False)
End Sub
Friend WithEvents MyDocumentViewer As DigitalData.Controls.DocumentViewer.DocumentViewer
Friend WithEvents Panel1 As Panel
Friend WithEvents Button1 As Button
Friend WithEvents TextBox1 As TextBox
Friend WithEvents txtfilepath As TextBox
Friend WithEvents OpenFileDialog1 As OpenFileDialog
Friend WithEvents Button2 As Button
Friend WithEvents Button3 As Button
Friend WithEvents Button4 As Button
Friend WithEvents Button5 As Button
Friend WithEvents MyDocumentViewer As DigitalData.Controls.DocumentViewer.DocumentViewer
End Class

View File

@ -8,13 +8,13 @@ Public Class frmDocView
Private Const GDPICTURE_KEY = "kG1Qf9PwmqgR8aDmIW2zI_ebj48RzqAJegRxcystEmkbTGQqfkNBdFOXIb6C_A00Ra8zZkrHdfjqzOPXK7kgkF2YDhvrqKfqh4WDug2vOt0qO31IommzkANSuLjZ4zmraoubyEVd25rE3veQ2h_j7tGIoH_LyIHmy24GaXsxdG0yCzIBMdiLbMMMDwcPY-809KeZ83Grv76OVhFvcbBWyYc251vou1N-kGg5_ZlHDgfWoY85gTLRxafjD3KS_i9ARW4BMiy36y8n7UP2jN8kGRnW_04ubpFtfjJqvtsrP_J9D0x7bqV8xtVtT5JI6dpKsVTiMgDCrIcoFSo5gCC1fw9oUopX4TDCkBQttO4-WHBlOeq9dG5Yb0otonVmJKaQA2tP6sMR-lZDs3ql_WI9t91yPWgpssrJUxSHDd27_LMTH_owJIqkF3NOJd9mYQuAv22oNKFYbH8e41pVKb8cT33Y9CgcQ_sy6YDA5PTuIRi67mjKge_nD9rd0IN213Ir9M_EFWqg9e4haWzIdHXQUo0md70kVhPX4UIH_BKJnxEEnFfoFRNMh77bB0N4jkcBEHPl-ghOERv8dOztf4vCnNpzzWvcLD2cqWIm6THy8XGGq9h4hp8aEreRleSMwv9QQAC7mjLwhQ1rBYkpUHlpTjhTLnMwHknl6HH0Z6zzmsgkRKVyfquv94Pd7QbQfZrRka0ss_48pf9p8hAywEn81Q=="
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If String.IsNullOrEmpty(TextBox1.Text) Then
If String.IsNullOrEmpty(txtfilepath.Text) Then
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
TextBox1.Text = OpenFileDialog1.FileName
MyDocumentViewer.LoadFile(TextBox1.Text)
txtfilepath.Text = OpenFileDialog1.FileName
MyDocumentViewer.LoadFile(txtfilepath.Text)
End If
Else
MyDocumentViewer.LoadFile(TextBox1.Text)
MyDocumentViewer.LoadFile(txtfilepath.Text)
End If
End Sub
@ -30,6 +30,7 @@ Public Class frmDocView
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
MyDocumentViewer.Done()
txtfilepath.Text = ""
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
@ -46,7 +47,7 @@ Public Class frmDocView
licenseManager.RegisterKEY(GDPICTURE_KEY)
Dim oPDFConverter = New PDFConverter(LogConfig)
Dim oResult = oPDFConverter.ConvertPDFADocumentToPDFDocument(TextBox1.Text, TextBox1.Text & ".cloned.pdf")
Dim oResult = oPDFConverter.ConvertPDFADocumentToPDFDocument(txtfilepath.Text, txtfilepath.Text & ".cloned.pdf")
If oResult = True Then
MsgBox("Document was successfully cloned!")