diff --git a/App.config b/App.config
index 7d3241d..2dc4e2e 100644
--- a/App.config
+++ b/App.config
@@ -49,34 +49,14 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
+
diff --git a/Baget/Aplicacion.nuspec b/Baget/Aplicacion.nuspec
index ca97fdc..20691dc 100644
--- a/Baget/Aplicacion.nuspec
+++ b/Baget/Aplicacion.nuspec
@@ -2,7 +2,7 @@
tsWPF
- 5.0.5.0
+ 5.0.6.0
Tecnosis
Tecnosis
false
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index f66ff9f..f79d799 100644
--- a/My Project/AssemblyInfo.vb
+++ b/My Project/AssemblyInfo.vb
@@ -55,11 +55,12 @@ Imports System.Windows
' mediante el asterisco ('*'), como se muestra a continuación:
'
-
-
+
+
-' 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
diff --git a/Utilidades/Utilidades.vb b/Utilidades/Utilidades.vb
index 416b660..916e532 100644
--- a/Utilidades/Utilidades.vb
+++ b/Utilidades/Utilidades.vb
@@ -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
\ No newline at end of file
diff --git a/tsWPF.vbproj b/tsWPF.vbproj
index b463bc6..f7ad212 100644
--- a/tsWPF.vbproj
+++ b/tsWPF.vbproj
@@ -576,7 +576,7 @@
10.0.5
- 3.0.3
+ 3.0.4
1.0.1