Compare commits
3 Commits
594d71bc75
...
308fdef2f8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
308fdef2f8 | ||
|
|
a7125add1e | ||
|
|
10e2579df4 |
@@ -7,6 +7,7 @@ Imports DevExpress.Spreadsheet
|
||||
Imports GdPicture14
|
||||
Imports DevExpress
|
||||
Imports DevExpress.Office.Utils
|
||||
Imports System.IO
|
||||
|
||||
Public Class DocumentViewer
|
||||
Private Enum ZoomMode
|
||||
@@ -83,9 +84,6 @@ Public Class DocumentViewer
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||||
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||||
|
||||
_logger.Info("Loading File {0}", FilePath)
|
||||
|
||||
DoLoadFile(FilePath)
|
||||
@@ -93,6 +91,21 @@ Public Class DocumentViewer
|
||||
UpdateMainUi()
|
||||
End Sub
|
||||
|
||||
Public Sub LoadFile(FileName As String, Stream As Stream)
|
||||
If _licenseKey = String.Empty Then
|
||||
_logger.Warn("License key was not provided. File [{0}] not loaded.", FileName)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oExtension As String = FileName.Substring(FileName.LastIndexOf("."))
|
||||
|
||||
_logger.Info("Loading File [{0}]", FileName)
|
||||
|
||||
DoLoadFile(Stream, oExtension)
|
||||
|
||||
UpdateMainUi()
|
||||
End Sub
|
||||
|
||||
Public Sub CloseDocument()
|
||||
GdViewer.CloseDocument()
|
||||
UpdateMainUi()
|
||||
@@ -139,32 +152,13 @@ Public Class DocumentViewer
|
||||
RichEditControl1.Dock = DockStyle.Fill
|
||||
|
||||
Case ".EML", ".DOC", ".DOCX", ".ODT", ".RTF", ".TXT"
|
||||
Dim oFormat As XtraRichEdit.DocumentFormat = XtraRichEdit.DocumentFormat.Undefined
|
||||
|
||||
Select Case oExtension.ToUpper
|
||||
Case ".EML" : oFormat = XtraRichEdit.DocumentFormat.Mht
|
||||
Case ".DOC" : oFormat = XtraRichEdit.DocumentFormat.Doc
|
||||
Case ".DOCX" : oFormat = XtraRichEdit.DocumentFormat.OpenXml
|
||||
Case ".ODT" : oFormat = XtraRichEdit.DocumentFormat.OpenDocument
|
||||
Case ".RTF" : oFormat = XtraRichEdit.DocumentFormat.Rtf
|
||||
Case ".TXT" : oFormat = XtraRichEdit.DocumentFormat.PlainText
|
||||
End Select
|
||||
|
||||
RichEditControl1.LoadDocument(FilePath, oFormat)
|
||||
RichEditControl1.LoadDocument(FilePath, GetDocumentFormat(oExtension))
|
||||
|
||||
RichEditControl1.Visible = True
|
||||
RichEditControl1.Dock = DockStyle.Fill
|
||||
|
||||
Case ".XLSX", ".XLS", "CSV"
|
||||
Dim oFormat As Spreadsheet.DocumentFormat = Spreadsheet.DocumentFormat.Undefined
|
||||
|
||||
Select Case oExtension.ToUpper
|
||||
Case "XLSX" : oFormat = Spreadsheet.DocumentFormat.Xlsx
|
||||
Case "XLS" : oFormat = Spreadsheet.DocumentFormat.Xls
|
||||
Case "CSV" : oFormat = Spreadsheet.DocumentFormat.Csv
|
||||
End Select
|
||||
|
||||
SpreadsheetControl1.LoadDocument(FilePath, oFormat)
|
||||
SpreadsheetControl1.LoadDocument(FilePath, GetSpreadsheetFormat(oExtension))
|
||||
|
||||
Dim oRange = SpreadsheetControl1.ActiveWorksheet.GetUsedRange()
|
||||
oRange.AutoFitColumns()
|
||||
@@ -175,13 +169,103 @@ Public Class DocumentViewer
|
||||
Case Else
|
||||
mainToolStrip.Visible = True
|
||||
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||||
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||||
|
||||
GdViewer.DisplayFromFile(FilePath)
|
||||
End Select
|
||||
|
||||
UpdateMainUi()
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub DoLoadFile(Stream As Stream, Extension As String)
|
||||
Try
|
||||
RichEditControl1.Visible = False
|
||||
RichEditControl1.Dock = DockStyle.None
|
||||
|
||||
SpreadsheetControl1.Visible = False
|
||||
SpreadsheetControl1.Dock = DockStyle.None
|
||||
|
||||
mainToolStrip.Visible = False
|
||||
|
||||
Select Case Extension.ToUpper
|
||||
Case ".MSG"
|
||||
Dim oMsg As New Message(Stream)
|
||||
|
||||
' TODO: Improve Encoding, maybe convert based on encoding
|
||||
oMsg.Encoding = System.Text.Encoding.UTF32
|
||||
Dim oMime = oMsg.ConvertToMimeMessage()
|
||||
Dim oTempFileName = IO.Path.GetTempFileName()
|
||||
oMime.Save(oTempFileName, True)
|
||||
|
||||
RichEditControl1.LoadDocument(oTempFileName, XtraRichEdit.DocumentFormat.Mht)
|
||||
|
||||
_TempFiles.Add(oTempFileName)
|
||||
|
||||
RichEditControl1.Visible = True
|
||||
RichEditControl1.Dock = DockStyle.Fill
|
||||
|
||||
Case ".EML", ".DOC", ".DOCX", ".ODT", ".RTF", ".TXT"
|
||||
RichEditControl1.LoadDocument(Stream, GetDocumentFormat(Extension))
|
||||
|
||||
RichEditControl1.Visible = True
|
||||
RichEditControl1.Dock = DockStyle.Fill
|
||||
|
||||
Case ".XLSX", ".XLS", "CSV"
|
||||
SpreadsheetControl1.LoadDocument(Stream, GetSpreadsheetFormat(Extension))
|
||||
|
||||
Dim oRange = SpreadsheetControl1.ActiveWorksheet.GetUsedRange()
|
||||
oRange.AutoFitColumns()
|
||||
|
||||
SpreadsheetControl1.Visible = True
|
||||
SpreadsheetControl1.Dock = DockStyle.Fill
|
||||
|
||||
Case Else
|
||||
mainToolStrip.Visible = True
|
||||
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||||
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||||
|
||||
GdViewer.DisplayFromStream(Stream)
|
||||
End Select
|
||||
|
||||
UpdateMainUi()
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function GetSpreadsheetFormat(Extension) As Spreadsheet.DocumentFormat
|
||||
Dim oFormat As Spreadsheet.DocumentFormat = Spreadsheet.DocumentFormat.Undefined
|
||||
|
||||
Select Case Extension.ToUpper
|
||||
Case "XLSX" : oFormat = Spreadsheet.DocumentFormat.Xlsx
|
||||
Case "XLS" : oFormat = Spreadsheet.DocumentFormat.Xls
|
||||
Case "CSV" : oFormat = Spreadsheet.DocumentFormat.Csv
|
||||
End Select
|
||||
|
||||
Return oFormat
|
||||
End Function
|
||||
|
||||
Private Function GetDocumentFormat(Extension)
|
||||
Dim oFormat As XtraRichEdit.DocumentFormat = XtraRichEdit.DocumentFormat.Undefined
|
||||
|
||||
Select Case Extension.ToUpper
|
||||
Case ".EML" : oFormat = XtraRichEdit.DocumentFormat.Mht
|
||||
Case ".DOC" : oFormat = XtraRichEdit.DocumentFormat.Doc
|
||||
Case ".DOCX" : oFormat = XtraRichEdit.DocumentFormat.OpenXml
|
||||
Case ".ODT" : oFormat = XtraRichEdit.DocumentFormat.OpenDocument
|
||||
Case ".RTF" : oFormat = XtraRichEdit.DocumentFormat.Rtf
|
||||
Case ".TXT" : oFormat = XtraRichEdit.DocumentFormat.PlainText
|
||||
End Select
|
||||
|
||||
Return oFormat
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub btnOpen_Click(sender As Object, e As EventArgs)
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||||
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.2.0")>
|
||||
<Assembly: AssemblyVersion("1.0.3.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
60
GUIs.Test.EDMIBenchmark/Form1.Designer.vb
generated
60
GUIs.Test.EDMIBenchmark/Form1.Designer.vb
generated
@@ -37,11 +37,20 @@ Partial Class Form1
|
||||
Me.RibbonPage2 = New DevExpress.XtraBars.Ribbon.RibbonPage()
|
||||
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
|
||||
Me.listboxLog = New DevExpress.XtraEditors.ListBoxControl()
|
||||
Me.XtraTabControl1 = New DevExpress.XtraTab.XtraTabControl()
|
||||
Me.XtraTabPage1 = New DevExpress.XtraTab.XtraTabPage()
|
||||
Me.XtraTabPage2 = New DevExpress.XtraTab.XtraTabPage()
|
||||
Me.listboxFileids = New DevExpress.XtraEditors.ListBoxControl()
|
||||
CType(Me.listboxFiles, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SplitContainerControl1.SuspendLayout()
|
||||
CType(Me.listboxLog, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.XtraTabControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.XtraTabControl1.SuspendLayout()
|
||||
Me.XtraTabPage1.SuspendLayout()
|
||||
Me.XtraTabPage2.SuspendLayout()
|
||||
CType(Me.listboxFileids, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'listboxFiles
|
||||
@@ -49,7 +58,7 @@ Partial Class Form1
|
||||
Me.listboxFiles.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.listboxFiles.Location = New System.Drawing.Point(0, 0)
|
||||
Me.listboxFiles.Name = "listboxFiles"
|
||||
Me.listboxFiles.Size = New System.Drawing.Size(536, 295)
|
||||
Me.listboxFiles.Size = New System.Drawing.Size(536, 270)
|
||||
Me.listboxFiles.TabIndex = 1
|
||||
'
|
||||
'RibbonControl1
|
||||
@@ -131,13 +140,13 @@ Partial Class Form1
|
||||
'SplitContainerControl1
|
||||
'
|
||||
Me.SplitContainerControl1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.SplitContainerControl1.Location = New System.Drawing.Point(0, 158)
|
||||
Me.SplitContainerControl1.Location = New System.Drawing.Point(0, 0)
|
||||
Me.SplitContainerControl1.Name = "SplitContainerControl1"
|
||||
Me.SplitContainerControl1.Panel1.Controls.Add(Me.listboxFiles)
|
||||
Me.SplitContainerControl1.Panel1.Text = "Panel1"
|
||||
Me.SplitContainerControl1.Panel2.Controls.Add(Me.listboxLog)
|
||||
Me.SplitContainerControl1.Panel2.Text = "Panel2"
|
||||
Me.SplitContainerControl1.Size = New System.Drawing.Size(1145, 295)
|
||||
Me.SplitContainerControl1.Size = New System.Drawing.Size(1143, 270)
|
||||
Me.SplitContainerControl1.SplitterPosition = 536
|
||||
Me.SplitContainerControl1.TabIndex = 4
|
||||
'
|
||||
@@ -146,15 +155,47 @@ Partial Class Form1
|
||||
Me.listboxLog.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.listboxLog.Location = New System.Drawing.Point(0, 0)
|
||||
Me.listboxLog.Name = "listboxLog"
|
||||
Me.listboxLog.Size = New System.Drawing.Size(599, 295)
|
||||
Me.listboxLog.Size = New System.Drawing.Size(597, 270)
|
||||
Me.listboxLog.TabIndex = 0
|
||||
'
|
||||
'XtraTabControl1
|
||||
'
|
||||
Me.XtraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.XtraTabControl1.Location = New System.Drawing.Point(0, 158)
|
||||
Me.XtraTabControl1.Name = "XtraTabControl1"
|
||||
Me.XtraTabControl1.SelectedTabPage = Me.XtraTabPage1
|
||||
Me.XtraTabControl1.Size = New System.Drawing.Size(1145, 295)
|
||||
Me.XtraTabControl1.TabIndex = 7
|
||||
Me.XtraTabControl1.TabPages.AddRange(New DevExpress.XtraTab.XtraTabPage() {Me.XtraTabPage1, Me.XtraTabPage2})
|
||||
'
|
||||
'XtraTabPage1
|
||||
'
|
||||
Me.XtraTabPage1.Controls.Add(Me.SplitContainerControl1)
|
||||
Me.XtraTabPage1.Name = "XtraTabPage1"
|
||||
Me.XtraTabPage1.Size = New System.Drawing.Size(1143, 270)
|
||||
Me.XtraTabPage1.Text = "XtraTabPage1"
|
||||
'
|
||||
'XtraTabPage2
|
||||
'
|
||||
Me.XtraTabPage2.Controls.Add(Me.listboxFileids)
|
||||
Me.XtraTabPage2.Name = "XtraTabPage2"
|
||||
Me.XtraTabPage2.Size = New System.Drawing.Size(1143, 270)
|
||||
Me.XtraTabPage2.Text = "XtraTabPage2"
|
||||
'
|
||||
'listboxFileids
|
||||
'
|
||||
Me.listboxFileids.Dock = System.Windows.Forms.DockStyle.Left
|
||||
Me.listboxFileids.Location = New System.Drawing.Point(0, 0)
|
||||
Me.listboxFileids.Name = "listboxFileids"
|
||||
Me.listboxFileids.Size = New System.Drawing.Size(278, 270)
|
||||
Me.listboxFileids.TabIndex = 0
|
||||
'
|
||||
'Form1
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(1145, 477)
|
||||
Me.Controls.Add(Me.SplitContainerControl1)
|
||||
Me.Controls.Add(Me.XtraTabControl1)
|
||||
Me.Controls.Add(Me.RibbonStatusBar1)
|
||||
Me.Controls.Add(Me.RibbonControl1)
|
||||
Me.Name = "Form1"
|
||||
@@ -166,6 +207,11 @@ Partial Class Form1
|
||||
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.SplitContainerControl1.ResumeLayout(False)
|
||||
CType(Me.listboxLog, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.XtraTabControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.XtraTabControl1.ResumeLayout(False)
|
||||
Me.XtraTabPage1.ResumeLayout(False)
|
||||
Me.XtraTabPage2.ResumeLayout(False)
|
||||
CType(Me.listboxFileids, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
|
||||
@@ -184,4 +230,8 @@ Partial Class Form1
|
||||
Friend WithEvents buttonClearLog As DevExpress.XtraBars.BarButtonItem
|
||||
Friend WithEvents RibbonPageGroup3 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
|
||||
Friend WithEvents buttonClearFiles As DevExpress.XtraBars.BarButtonItem
|
||||
Friend WithEvents XtraTabControl1 As DevExpress.XtraTab.XtraTabControl
|
||||
Friend WithEvents XtraTabPage1 As DevExpress.XtraTab.XtraTabPage
|
||||
Friend WithEvents XtraTabPage2 As DevExpress.XtraTab.XtraTabPage
|
||||
Friend WithEvents listboxFileids As DevExpress.XtraEditors.ListBoxControl
|
||||
End Class
|
||||
|
||||
@@ -53,6 +53,7 @@ Public Class Form1
|
||||
Dim oResult As EDMIServiceReference.DocumentResult2 = Await _Channel.ImportFileAsync(oFileInfo, oContents, False, 0)
|
||||
If oResult.OK Then
|
||||
listboxLog.Items.Add($"File {oFileInfo.Name} imported!")
|
||||
listboxFileids.Items.Add(oResult.Document.FileId)
|
||||
Else
|
||||
listboxLog.Items.Add($"Import Error: {oResult.ErrorMessage}")
|
||||
End If
|
||||
|
||||
@@ -54,6 +54,9 @@
|
||||
<Reference Include="DevExpress.Utils.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraBars.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||
<Reference Include="DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||
<Reference Include="DigitalData.Controls.DocumentViewer">
|
||||
<HintPath>..\Controls.DocumentViewer\obj\Debug\DigitalData.Controls.DocumentViewer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
|
||||
Reference in New Issue
Block a user