' 14/05/2027 V 5.0.6 Correcciones en ienumerableaexel

This commit is contained in:
2026-05-22 14:02:12 +02:00
parent a791d6b746
commit faa931c912
5 changed files with 42 additions and 37 deletions

View File

@@ -50,22 +50,6 @@
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.4.0" newVersion="4.2.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.9" newVersion="9.0.0.9" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.9" newVersion="9.0.0.9" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup>
@@ -73,10 +57,6 @@
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="IronOcr.Spanish" publicKeyToken="5f366048dc436899" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.20747" newVersion="4.0.0.20747" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />

View File

@@ -2,7 +2,7 @@
<package >
<metadata>
<id>tsWPF</id>
<version>5.0.5.0</version>
<version>5.0.6.0</version>
<authors>Tecnosis</authors>
<owners>Tecnosis</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>

View File

@@ -55,11 +55,12 @@ Imports System.Windows
' mediante el asterisco ('*'), como se muestra a continuación:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("5.0.5.0")>
<Assembly: AssemblyFileVersion("5.0.5.0")>
<Assembly: AssemblyVersion("5.0.6.0")>
<Assembly: AssemblyFileVersion("5.0.6.0")>
' Cambios en la versión 5.0.5.0
' Cambios en la versión 5.0.6.0
' 14/05/2027 V 5.0.6 Correcciones en ienumerableaexel
' 14/05/2026 V 5.0.5 Correcciones de dependencias

View File

@@ -273,36 +273,60 @@ Namespace Utilidades
Public Shared Sub IEnumerableAExcel(Of t)(Datos As IEnumerable(Of t), Fichero As String)
Dim wb As New ClosedXML.Excel.XLWorkbook
Dim dt = tsl5.Extensiones.IEnumerableExtensions.CopyToDataTable(Of t)(Datos)
wb.AddWorksheet(dt)
Dim ws = wb.AddWorksheet(dt)
ws.Columns().AdjustToContents()
wb.SaveAs(Fichero)
End Sub
Public Shared Sub IEnumerableAExcel(Of t)(Datos As List(Of t), Fichero As String)
Dim wb As New ClosedXML.Excel.XLWorkbook
Dim dt = tsl5.Extensiones.IEnumerableExtensions.CopyToDataTable(Of t)(Datos)
wb.AddWorksheet(dt)
Dim ws = wb.AddWorksheet(dt)
ws.Columns().AdjustToContents()
wb.SaveAs(Fichero)
End Sub
Public Shared Function IEnumerableAExcel(Of t)(Datos As List(Of t)) As Byte()
Dim wb As New ClosedXML.Excel.XLWorkbook
Dim dt = tsl5.Extensiones.IEnumerableExtensions.CopyToDataTable(Of t)(Datos)
wb.AddWorksheet(dt)
Dim ws = wb.AddWorksheet(dt)
ws.Columns().AdjustToContents()
Dim ms As New MemoryStream
wb.SaveAs(ms)
ms.Position = 0
Return ms.ToArray
End Function
Public Shared Function ListaIEnumerableAExcel(Of t)(Datos As List(Of List(Of t)), NombreTablas As List(Of String)) As Byte()
Public Shared Function ListaIEnumerableAExcel(Of T)(Datos As List(Of List(Of T)), NombreTablas As List(Of String)) As Byte()
If Datos Is Nothing OrElse NombreTablas Is Nothing Then
Throw New ArgumentNullException("Los parámetros no pueden ser Nothing.")
End If
If Datos.Count <> NombreTablas.Count Then
Throw New ArgumentException("La cantidad de listas y nombres de tablas no coincide.")
End If
Dim wb As New ClosedXML.Excel.XLWorkbook
For i = 0 To Datos.Count - 1
Dim tabla = Datos(i)
Dim dt = tsl5.Extensiones.IEnumerableExtensions.CopyToDataTable(Of t)(tabla)
wb.AddWorksheet(dt, NombreTablas(i))
' Evitar error si la lista está vacía
If tabla Is Nothing OrElse tabla.Count = 0 Then
Dim wsVacio = wb.AddWorksheet(NombreTablas(i))
Continue For
End If
Dim dt = tsl5.Extensiones.IEnumerableExtensions.CopyToDataTable(Of T)(tabla)
Dim ws = wb.AddWorksheet(dt, NombreTablas(i))
' Autoajuste de columnas
ws.Columns().AdjustToContents()
Next
Dim ms As New MemoryStream
wb.SaveAs(ms)
ms.Position = 0
Return ms.ToArray
Using ms As New MemoryStream
wb.SaveAs(ms)
Return ms.ToArray()
End Using
End Function
End Class
End Namespace

View File

@@ -576,7 +576,7 @@
<Version>10.0.5</Version>
</PackageReference>
<PackageReference Include="tsl5">
<Version>3.0.3</Version>
<Version>3.0.4</Version>
</PackageReference>
<PackageReference Include="TSpdf.commons">
<Version>1.0.1</Version>