Rep Personal DIM saltos delinea en titulos de cabecera

This commit is contained in:
Oscar Irigoyen
2023-06-20 14:57:19 -07:00
parent fd5962a6e7
commit 08b8d3de9e
2 changed files with 1044 additions and 529 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -85,6 +85,8 @@ Partial Class Nomina_RepPersonalDIM
GvDatos.DataBind()
UpAcciones.Update()
UpGvCargaDatos.Update()
End Sub
@@ -105,38 +107,44 @@ Partial Class Nomina_RepPersonalDIM
End Sub
Protected Sub LnkDescargaArchivo_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LnkDescargaArchivo.Click
Dim tabla As DataTable = Dt_Datos ' Reemplaza esto con tu método para obtener la tabla
Dim tabla As DataTable = Dt_Datos
Dim contenido As String = ConvertirTablaATexto(tabla)
Dim contenidoBytes As Byte() = Encoding.UTF8.GetBytes(ConvertirTablaATexto(tabla))
' Guardar el archivo en el servidor
Dim nombreArchivo As String = "tabla.txt"
Dim rutaArchivo As String = Server.MapPath("~/Descargas/" & nombreArchivo)
File.WriteAllText(rutaArchivo, contenido)
Using memoryStream As New MemoryStream(contenidoBytes)
Response.Clear()
Response.ContentType = "text/plain"
Response.AddHeader("Content-Disposition", $"attachment; filename=RepPersonalDIM{DdlEjercicio.SelectedItem.Text}.txt")
memoryStream.WriteTo(Response.OutputStream)
End Using
' Descargar el archivo
Response.ContentType = "text/plain"
Response.AppendHeader("Content-Disposition", "attachment; filename=" & nombreArchivo)
Response.TransmitFile(rutaArchivo)
Response.End()
End Sub
Public Function ConvertirTablaATexto(ByVal tabla As DataTable) As String
'Dim sb As New StringBuilder()
'For Each GvRow As GridViewRow In GvDatos.Rows
' For Each GvCell As TableCell In GvRow.Cells
' sb.Append(GvCell.ID & "|")
' Next
' sb.AppendLine()
'Next
'Return sb.ToString()
Dim sb As New StringBuilder()
For Each fila As DataRow In tabla.Rows
For i As Integer = 0 To tabla.Columns.Count - 1
sb.Append(fila(i).ToString())
If i < tabla.Columns.Count - 1 Then
sb.Append("|") ' Agrega el separador de pipes
End If
For Each gvRow As GridViewRow In GvDatos.Rows
For Each gvCell As TableCell In gvRow.Cells
Dim columnIndex As Integer = gvRow.Cells.GetCellIndex(gvCell)
Dim rowIndex As Integer = gvRow.RowIndex
Dim cellID As String = "cell_" & rowIndex.ToString() & "_" & columnIndex.ToString()
sb.Append(gvRow.Cells(columnIndex).Controls(0).ClientID & "|")
Next
sb.AppendLine() ' Agrega un salto de línea al final de cada fila
sb.AppendLine()
Next
Return sb.ToString()
End Function
#End Region
@@ -153,17 +161,17 @@ Partial Class Nomina_RepPersonalDIM
cell = New TableHeaderCell()
cell.ColumnSpan = 16
cell.ColumnSpan = 18
cell.Text = "ANEXO 1 PAGOS POR SEPARACION ->"
cell.HorizontalAlign = HorizontalAlign.Left
row.Controls.Add(cell)
cell = New TableHeaderCell()
cell.ColumnSpan = 2
cell.Text = " ANEXO 1 ASIM SAL-> "
cell.HorizontalAlign = HorizontalAlign.Left
row.Controls.Add(cell)
'cell = New TableHeaderCell()
'cell.ColumnSpan = 2
'cell.Text = " ANEXO 1 ASIM SAL-> "
'cell.HorizontalAlign = HorizontalAlign.Left
'row.Controls.Add(cell)
cell = New TableHeaderCell()