-- exporta excel gembox, sección filtros

This commit is contained in:
2021-11-29 15:28:14 -07:00
parent d80c4076b3
commit f729e7d5fd
2 changed files with 31 additions and 36 deletions

View File

@@ -2086,7 +2086,7 @@ Namespace Extensiones
End Sub
<Runtime.CompilerServices.Extension()>
Public Sub ExportToExcelGembox(GridView As GridView, NombreArchivoXLSx As String, Usuario As Usuario, FechaIMes As String, FechaFMes As String, Titulo As String, SubProyecto As String, Divisor As Integer, Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100, Optional DatoTituloExtra As String = "")
Public Sub ExportToExcelGembox(GridView As GridView, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional DatoTituloExtra As String = "", Optional DatosFiltros As String = "", Optional AnchoImagen As Integer = 100, Optional AlturaImagen As Integer = 100)
Dim sw1 As New StringWriter()
Dim htw1 As New HtmlTextWriter(sw1)
@@ -2117,7 +2117,7 @@ Namespace Extensiones
If Usuario IsNot Nothing Then
Dim TotalRowHeader As Integer = 8
Dim TotalRowHeader As Integer = 6
Dim TotalRowFooter As Integer = 2
@@ -2143,50 +2143,44 @@ Namespace Extensiones
RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
If FechaIMes.Trim.Length > 0 And FechaFMes.Trim.Length > 0 Then
Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex)
RangoFechas.Merged = True
RangoFechas.Value = $"Fechas: {FechaIMes} a {FechaFMes}"
RangoFechas.Style.Font.Size = 15 * 20
RangoFechas.Style.Font.Name = "Calibri Light"
RangoFechas.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoFechas.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
End If
If SubProyecto.Length > 0 Then
Dim RangoSubProyecto = worksheet.Cells.GetSubrangeAbsolute(5, celdasConTexto.FirstColumnIndex, 5, celdasConTexto.LastColumnIndex)
RangoSubProyecto.Merged = True
RangoSubProyecto.Value = SubProyecto
RangoSubProyecto.Style.Font.Size = 20 * 20
RangoSubProyecto.Style.Font.Name = "Calibri Light"
RangoSubProyecto.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoSubProyecto.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
End If
If DatoTituloExtra.Length > 0 Then
Dim RangoDatoTituloExtra = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex)
Dim RangoDatoTituloExtra = worksheet.Cells.GetSubrangeAbsolute(TotalRowHeader, celdasConTexto.FirstColumnIndex, TotalRowHeader, celdasConTexto.LastColumnIndex)
RangoDatoTituloExtra.Merged = True
RangoDatoTituloExtra.Value = DatoTituloExtra
RangoDatoTituloExtra.Style.Font.Size = 20 * 20
RangoDatoTituloExtra.Style.Font.Name = "Calibri Light"
RangoDatoTituloExtra.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoDatoTituloExtra.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left
RangoDatoTituloExtra.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
End If
If DatosFiltros.Length > 0 Then
Dim Arreglo As String() = DatosFiltros.Split("|"c)
worksheet.Rows.InsertEmpty(TotalRowHeader, Arreglo.Count)
For Each TextoFiltro As String In Arreglo
Dim RangoDatoTituloExtra = worksheet.Cells.GetSubrangeAbsolute(TotalRowHeader, celdasConTexto.FirstColumnIndex, TotalRowHeader, celdasConTexto.LastColumnIndex)
RangoDatoTituloExtra.Merged = True
RangoDatoTituloExtra.Value = TextoFiltro
RangoDatoTituloExtra.Style.Font.Size = 12 * 20
RangoDatoTituloExtra.Style.Font.Name = "Calibri Light"
RangoDatoTituloExtra.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left
RangoDatoTituloExtra.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
TotalRowHeader += 1
Next
End If
TotalRowHeader += 2
For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20
worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
worksheet.Rows(TotalRowHeader).Cells(i).Style.Font.Size = 12 * 20
worksheet.Rows(TotalRowHeader).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
worksheet.Rows(TotalRowHeader).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
worksheet.Rows(TotalRowHeader).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
worksheet.Rows(TotalRowHeader).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
If i > 0 Then
Try
@@ -2221,7 +2215,7 @@ Namespace Extensiones
If I > 0 Then
If Divisor = 1 Then
If 1 = 1 Then
worksheet.Columns(I + 1).Style.NumberFormat = "#,##0.00"
Else
worksheet.Columns(I + 1).Style.NumberFormat = "#,##"

View File

@@ -497,7 +497,8 @@ Partial Class Inventarios_RepAnomalias
Private Sub LnkDescarExcelGrupos_Click(sender As Object, e As EventArgs) Handles LnkDescarExcelGrupos.Click
GvGrupos.ExportToExcelGembox("Reporte de Inventario Fisico" & Now.ToShortDateString, UsuarioActual, "", "", "Inventario:" & lbTitulo.Text, "", 1)
Dim Filtros As String = "Almacenes:aASDSAF|Clasificaciones:sdfasf|Fecha:12/12/2323"
GvGrupos.ExportToExcelGembox("Reporte de Inventario Fisico" & Now.ToShortDateString, UsuarioActual, "Inventario:" & lbTitulo.Text, "", DatosFiltros:=Filtros)
End Sub
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)