Functions zur Prüfung der Base64 Bilder in den ActiveReports.
This commit is contained in:
@@ -3,7 +3,6 @@ Imports System.Globalization
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports System.Net
|
Imports System.Net
|
||||||
Imports System.Web.UI.WebControls.Expressions
|
Imports System.Web.UI.WebControls.Expressions
|
||||||
Imports GrapeCity.ActiveReports.Export.Pdf
|
|
||||||
Imports iText.Kernel.Pdf
|
Imports iText.Kernel.Pdf
|
||||||
Imports itextsharp.text.pdf
|
Imports itextsharp.text.pdf
|
||||||
Imports Microsoft.Office.Interop
|
Imports Microsoft.Office.Interop
|
||||||
|
|||||||
@@ -3684,6 +3684,24 @@ Public Class usrCntlFaktAbrechnung
|
|||||||
saveMe() 'Damit Prüfungen in der Vorschau funktionieren (zT mit DB abhängig -> ReverseCharge)
|
saveMe() 'Damit Prüfungen in der Vorschau funktionieren (zT mit DB abhängig -> ReverseCharge)
|
||||||
getValues()
|
getValues()
|
||||||
|
|
||||||
|
'If RECHNUNG IsNot Nothing AndAlso RECHNUNG.Firma_ID > 0 Then
|
||||||
|
' Select Case RECHNUNG.Firma_ID
|
||||||
|
' Case 19
|
||||||
|
' Dim rpt As New rptRechnungDruck_MDM
|
||||||
|
' If VERAG_PROG_ALLGEMEIN.cProgramFunctions.CheckReportImages(rpt).Count > 0 Then
|
||||||
|
' Exit Sub
|
||||||
|
' End If
|
||||||
|
' Case Else
|
||||||
|
|
||||||
|
' Dim rpt As New rptRechnungDruck
|
||||||
|
' If VERAG_PROG_ALLGEMEIN.cProgramFunctions.CheckReportImages(rpt).Count > 0 Then
|
||||||
|
' Exit Sub
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' End Select
|
||||||
|
|
||||||
|
|
||||||
|
'End If
|
||||||
|
|
||||||
cFakturierung.doRechnungsDruck(RECHNUNG,, True,,, getPrinterFromParent)
|
cFakturierung.doRechnungsDruck(RECHNUNG,, True,,, getPrinterFromParent)
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
@@ -87,6 +87,9 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>F:\PROGRAMMIERUNG\dll\OpenXML\DocumentFormat.OpenXml.dll</HintPath>
|
<HintPath>F:\PROGRAMMIERUNG\dll\OpenXML\DocumentFormat.OpenXml.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="DS.Documents.Imaging">
|
||||||
|
<HintPath>..\..\..\Aviso\AVISO\Gemeinsames\bin\Debug\DS.Documents.Imaging.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Dynamsoft.Forms.Viewer, Version=8.3.3.726, Culture=neutral, PublicKeyToken=298ad97013b423eb, processorArchitecture=MSIL">
|
<Reference Include="Dynamsoft.Forms.Viewer, Version=8.3.3.726, Culture=neutral, PublicKeyToken=298ad97013b423eb, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>F:\PROGRAMMIERUNG\dll\Dynamsoft\8.3.3\Dynamsoft.Forms.Viewer.dll</HintPath>
|
<HintPath>F:\PROGRAMMIERUNG\dll\Dynamsoft\8.3.3\Dynamsoft.Forms.Viewer.dll</HintPath>
|
||||||
@@ -123,6 +126,14 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>F:\PROGRAMMIERUNG\dll\McDull.Windows.Forms.dll</HintPath>
|
<HintPath>F:\PROGRAMMIERUNG\dll\McDull.Windows.Forms.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="MESCIUS.ActiveReports">
|
||||||
|
<HintPath>..\..\..\Aviso\AVISO\Gemeinsames\bin\Debug\MESCIUS.ActiveReports.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="MESCIUS.ActiveReports.Core.Document, Version=4.7.0.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
|
||||||
|
<Reference Include="MESCIUS.ActiveReports.Core.Document.Drawing.Gc, Version=4.7.0.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\..\Aviso\AVISO\Gemeinsames\bin\Debug\MESCIUS.ActiveReports.Core.Document.Drawing.Gc.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
Imports System.Drawing
|
Imports System.Drawing
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
|
Imports System.IO.Pipes
|
||||||
Imports System.Net.Mail
|
Imports System.Net.Mail
|
||||||
Imports System.Reflection
|
Imports System.Reflection
|
||||||
Imports System.Runtime.InteropServices
|
Imports System.Runtime.InteropServices
|
||||||
Imports System.Text
|
Imports System.Text
|
||||||
Imports System.Windows.Forms
|
Imports System.Windows.Forms
|
||||||
Imports ClosedXML.Excel
|
Imports ClosedXML.Excel
|
||||||
|
Imports GrapeCity.ActiveReports
|
||||||
|
Imports GrapeCity.ActiveReports.Core.Document.Drawing.Gc
|
||||||
|
Imports GrapeCity.ActiveReports.SectionReportModel
|
||||||
|
Imports GrapeCity.Documents.Imaging
|
||||||
Imports Microsoft.Office.Interop
|
Imports Microsoft.Office.Interop
|
||||||
Imports System.IO.Pipes
|
|
||||||
Imports ThoughtWorks.QRCode.Codec
|
Imports ThoughtWorks.QRCode.Codec
|
||||||
|
|
||||||
Public Class cProgramFunctions
|
Public Class cProgramFunctions
|
||||||
@@ -71,6 +75,135 @@ Public Class cProgramFunctions
|
|||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Shared Function CheckAllReportImages() As List(Of String)
|
||||||
|
|
||||||
|
Dim errors As New List(Of String)
|
||||||
|
|
||||||
|
For Each report As GrapeCity.ActiveReports.SectionReport In FindAllReports()
|
||||||
|
|
||||||
|
For Each section As GrapeCity.ActiveReports.SectionReportModel.Section In report.Sections
|
||||||
|
CheckImagesInControls(section.Controls, errors, report.GetType().Name, section.Name)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return errors
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Shared Function CheckReportImages(report As SectionReport) As List(Of String)
|
||||||
|
|
||||||
|
Dim errors As New List(Of String)
|
||||||
|
|
||||||
|
For Each section As GrapeCity.ActiveReports.SectionReportModel.Section In report.Sections
|
||||||
|
CheckImagesInControls(section.Controls, errors, report.GetType().Name, section.Name)
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
Return errors
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Shared Sub CheckImagesInControls(ctrls As GrapeCity.ActiveReports.SectionReportModel.ControlCollection, errors As List(Of String), reportName As String, sectionName As String)
|
||||||
|
|
||||||
|
For Each ctrl As GrapeCity.ActiveReports.SectionReportModel.ARControl In ctrls
|
||||||
|
|
||||||
|
If TypeOf ctrl Is GrapeCity.ActiveReports.SectionReportModel.Picture Then
|
||||||
|
|
||||||
|
Dim pic = CType(ctrl, GrapeCity.ActiveReports.SectionReportModel.Picture)
|
||||||
|
|
||||||
|
If Not String.IsNullOrEmpty(pic.ImageBase64String) Then
|
||||||
|
|
||||||
|
If Not IsBase64(pic.ImageBase64String) Then
|
||||||
|
errors.Add($"{reportName} | {sectionName} | {ctrl.Name} → Ungültiger Base64")
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Shared Function IsBase64(value As String) As Boolean
|
||||||
|
If String.IsNullOrWhiteSpace(value) Then Return False
|
||||||
|
|
||||||
|
Try
|
||||||
|
' Data-URL entfernen
|
||||||
|
If value.Contains(",") Then
|
||||||
|
value = value.Substring(value.IndexOf(",") + 1)
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Base64 dekodieren
|
||||||
|
Dim bytes() As Byte = Convert.FromBase64String(value)
|
||||||
|
|
||||||
|
Using ms As New MemoryStream(bytes)
|
||||||
|
' Instanz von GcBitmap erstellen
|
||||||
|
Dim bmp As GcBitmap = Nothing
|
||||||
|
Try
|
||||||
|
bmp = New GcBitmap(ms)
|
||||||
|
' Zugriff erzwingen
|
||||||
|
Dim w As Integer = bmp.Width
|
||||||
|
Dim h As Integer = bmp.Height
|
||||||
|
|
||||||
|
If w <= 0 OrElse h <= 0 Then Return False
|
||||||
|
|
||||||
|
Finally
|
||||||
|
If bmp IsNot Nothing Then
|
||||||
|
bmp.Dispose()
|
||||||
|
End If
|
||||||
|
End Try
|
||||||
|
End Using
|
||||||
|
|
||||||
|
Return True
|
||||||
|
|
||||||
|
Catch ex As TypeInitializationException
|
||||||
|
' Speziell Typeninitialisierer-Fehler abfangen
|
||||||
|
' z. B. "PerTypeValues`1 hat eine Ausnahme verursacht"
|
||||||
|
Return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
' Alle anderen Fehler ebenfalls als ungültig behandeln
|
||||||
|
Return False
|
||||||
|
|
||||||
|
Catch
|
||||||
|
Return False
|
||||||
|
|
||||||
|
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Shared Function FindAllReports() As List(Of SectionReport)
|
||||||
|
Dim list As New List(Of SectionReport)
|
||||||
|
|
||||||
|
' Alle geladenen Assemblies durchsuchen
|
||||||
|
For Each asm In AppDomain.CurrentDomain.GetAssemblies()
|
||||||
|
Try
|
||||||
|
For Each t In asm.GetTypes()
|
||||||
|
' Nur konkrete Klassen, die von SectionReport erben
|
||||||
|
If GetType(SectionReport).IsAssignableFrom(t) AndAlso t.IsClass AndAlso Not t.IsAbstract Then
|
||||||
|
Try
|
||||||
|
' Parameterloser Konstruktor
|
||||||
|
Dim instance As SectionReport = CType(Activator.CreateInstance(t), SectionReport)
|
||||||
|
list.Add(instance)
|
||||||
|
Catch ex As Exception
|
||||||
|
' Ignoriere Klassen ohne parameterlosen Konstruktor
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Catch
|
||||||
|
' Manche Assemblies lassen sich nicht durchsuchen
|
||||||
|
End Try
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return list
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Dim r As SectionReport
|
||||||
|
|
||||||
|
|
||||||
Public Shared Sub tryGetFilialeAbf_ByLRN(ByVal LRN As String, ByRef FilialenNr As Object, ByRef AbfertigungsNr As Object)
|
Public Shared Sub tryGetFilialeAbf_ByLRN(ByVal LRN As String, ByRef FilialenNr As Object, ByRef AbfertigungsNr As Object)
|
||||||
|
|
||||||
@@ -486,7 +619,7 @@ BindingFlags.Instance Or BindingFlags.NonPublic, Nothing, [Control], New Object(
|
|||||||
wb.Worksheets(0).Tables.FirstOrDefault().ShowAutoFilter = ShowAutoFilter
|
wb.Worksheets(0).Tables.FirstOrDefault().ShowAutoFilter = ShowAutoFilter
|
||||||
|
|
||||||
If rangeAsWaehrung IsNot Nothing Then
|
If rangeAsWaehrung IsNot Nothing Then
|
||||||
For Each r In rangeAsWaehrung
|
For Each r As String In rangeAsWaehrung
|
||||||
Try
|
Try
|
||||||
wb.Worksheets(0).Range(r).Style.NumberFormat.SetFormat("###,###,##0.00 " & waehrungsZeichen)
|
wb.Worksheets(0).Range(r).Style.NumberFormat.SetFormat("###,###,##0.00 " & waehrungsZeichen)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|||||||
Reference in New Issue
Block a user