Filtros en exportar a excel en reporte de anomalias
This commit is contained in:
@@ -268,7 +268,8 @@
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LblC" runat="server" Font-Size="6pt"></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="Clasificación" DataField="Clasificacion" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField HeaderText="Proveedor" DataField="NombreComercial" ItemStyle-HorizontalAlign="Left" Visible="false" />
|
||||
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-HorizontalAlign="Left" />
|
||||
@@ -325,7 +326,8 @@
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LblC" runat="server" Font-Size="6pt"></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="Clasificación" DataField="Clasificacion" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField HeaderText="Proveedor" DataField="NombreComercial" ItemStyle-HorizontalAlign="Left" Visible="false" />
|
||||
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-HorizontalAlign="Left" />
|
||||
@@ -375,7 +377,8 @@
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LblC" runat="server" Font-Size="6pt"></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="Clasificación" DataField="Clasificacion" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField HeaderText="Proveedor" DataField="NombreComercial" ItemStyle-HorizontalAlign="Left" Visible="false" />
|
||||
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-HorizontalAlign="Left" />
|
||||
@@ -474,7 +477,8 @@
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox ID="ChkPSFaltante" runat="server" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="Clasificación" DataField="Clasificacion" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField HeaderText="Proveedor" DataField="NombreComercial" ItemStyle-HorizontalAlign="Left" Visible="false" />
|
||||
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-HorizontalAlign="Left" />
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports Extensiones
|
||||
Imports GemBox.Spreadsheet
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Inventarios_RepAnomalias
|
||||
Inherits ClsPaginas
|
||||
|
||||
|
||||
Inherits ClsPaginas
|
||||
|
||||
|
||||
#Region "Propiedades"
|
||||
Public Property CveInventarioFisico As Integer
|
||||
Get
|
||||
@@ -57,10 +59,10 @@ Partial Class Inventarios_RepAnomalias
|
||||
Set(value As Boolean)
|
||||
ViewState("CreandoNuevoInventario") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
|
||||
@@ -73,12 +75,12 @@ Partial Class Inventarios_RepAnomalias
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
#Region " CARGA DATOS "
|
||||
|
||||
|
||||
Private Sub CargaDatos(CveInventarioFisico As Integer)
|
||||
Dim Inventario As New ClsInventarios
|
||||
Dim dt As DataTable = Nothing
|
||||
@@ -272,15 +274,15 @@ Partial Class Inventarios_RepAnomalias
|
||||
DVGrupos.Visible = True
|
||||
|
||||
If DdlGPO.SelectedValue.ToEntero = 2 Then
|
||||
GvGrupos.Columns(4).Visible = False
|
||||
GvGrupos.Columns(5).Visible = False
|
||||
GvGrupos.Columns(6).Visible = False
|
||||
GvGrupos.Columns(7).Visible = False
|
||||
GvGrupos.Columns(8).Visible = False
|
||||
Else
|
||||
GvGrupos.Columns(4).Visible = True
|
||||
GvGrupos.Columns(5).Visible = True
|
||||
GvGrupos.Columns(6).Visible = True
|
||||
GvGrupos.Columns(7).Visible = True
|
||||
GvGrupos.Columns(8).Visible = True
|
||||
End If
|
||||
|
||||
If DdlGPO.SelectedValue.ToEntero = 2 Then
|
||||
@@ -327,10 +329,10 @@ Partial Class Inventarios_RepAnomalias
|
||||
UPAcciones.Update()
|
||||
|
||||
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
#Region " FINALIZAR "
|
||||
Protected Sub btnFin_Click(sender As Object, e As EventArgs) Handles btnFin.Click
|
||||
Dim Inventarios As New ClsInventarios
|
||||
@@ -351,11 +353,11 @@ Partial Class Inventarios_RepAnomalias
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
||||
CargaDatos(CveInventarioFisico)
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
Protected Sub GVF_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvF.RowDataBound
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
@@ -393,16 +395,16 @@ Partial Class Inventarios_RepAnomalias
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#Region " IMPRIMIR "
|
||||
'Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
||||
' GvF.ExportToExcel("IF_Faltantes_" & Now.ToShortDateString())
|
||||
'End Sub
|
||||
'Protected Sub LnkExportaSobrantes_Click(sender As Object, e As EventArgs) Handles LnkExportaSobrantes.Click
|
||||
' GvS.ExportToExcel("IF_Sobrantes_" & Now.ToShortDateString())
|
||||
'End Sub
|
||||
|
||||
'Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
||||
' GvF.ExportToExcel("IF_Faltantes_" & Now.ToShortDateString())
|
||||
'End Sub
|
||||
'Protected Sub LnkExportaSobrantes_Click(sender As Object, e As EventArgs) Handles LnkExportaSobrantes.Click
|
||||
' GvS.ExportToExcel("IF_Sobrantes_" & Now.ToShortDateString())
|
||||
'End Sub
|
||||
|
||||
Private Sub LnkPDF_Click(sender As Object, e As EventArgs) Handles LnkPDF.Click
|
||||
ImprimirbytesPDF(Imprimir, Formato:="PDF")
|
||||
End Sub
|
||||
@@ -466,10 +468,27 @@ Partial Class Inventarios_RepAnomalias
|
||||
|
||||
For Each GvRow As GridViewRow In GvTemp.Rows
|
||||
GvRow.BackColor = Drawing.ColorTranslator.FromHtml("white")
|
||||
Next
|
||||
|
||||
'GvF.ExportToExcel("Reporte de Inventario Fisico - Productos que Faltan " & Now.ToShortDateString)
|
||||
GvTemp.ExportToExcel("Reporte de Inventario Fisico - Productos que Faltan " & Now.ToShortDateString)
|
||||
Next
|
||||
|
||||
Dim SbFiltros As New StringBuilder()
|
||||
SbFiltros.AppendFormat("Almacenes: {0}|", LblAlmacenes.Text)
|
||||
SbFiltros.AppendFormat("Fecha Inicio: {0} Fecha Fin: {1}|", lbFechaI.Text, lbFechaF.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Clasificaciones: {0}|", LblClasif.Text)
|
||||
SbFiltros.AppendFormat("Clasificaciones Excluidas: {0}|", LblClasificacionesExcluidas.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Productos: {0}|", LblProductos.Text)
|
||||
SbFiltros.AppendFormat("Productos Excluidos: {0}|", LblProductosExcluidos.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Proveedores: {0}|", LblProveedores.Text)
|
||||
SbFiltros.AppendFormat("SubProyecto: {0}|", lbSubProyecto.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Estatus: {0}|", lbEstatus.Text)
|
||||
|
||||
'GvF.ExportToExcel("Reporte de Inventario Fisico - Productos que Faltan " & Now.ToShortDateString)
|
||||
|
||||
ExportarExcelGembox(GvTemp, "Reporte de Inventario Fisico - Productos que Faltan " & Now.ToShortDateString, UsuarioActual, "Reporte de Inventario Fisico - Productos que Faltan", DatosFiltros:=SbFiltros.ToString())
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -478,10 +497,27 @@ Partial Class Inventarios_RepAnomalias
|
||||
|
||||
For Each GvRow As GridViewRow In GvTemp.Rows
|
||||
GvRow.BackColor = Drawing.ColorTranslator.FromHtml("white")
|
||||
Next
|
||||
Next
|
||||
|
||||
Dim SbFiltros As New StringBuilder()
|
||||
SbFiltros.AppendFormat("Almacenes: {0}|", LblAlmacenes.Text)
|
||||
SbFiltros.AppendFormat("Fecha Inicio: {0} Fecha Fin: {1}|", lbFechaI.Text, lbFechaF.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Clasificaciones: {0}|", LblClasif.Text)
|
||||
SbFiltros.AppendFormat("Clasificaciones Excluidas: {0}|", LblClasificacionesExcluidas.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Productos: {0}|", LblProductos.Text)
|
||||
SbFiltros.AppendFormat("Productos Excluidos: {0}|", LblProductosExcluidos.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Proveedores: {0}|", LblProveedores.Text)
|
||||
SbFiltros.AppendFormat("SubProyecto: {0}|", lbSubProyecto.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Estatus: {0}|", lbEstatus.Text)
|
||||
|
||||
'GvF.ExportToExcel("Reporte de Inventario Fisico - Productos que Faltan " & Now.ToShortDateString)
|
||||
|
||||
ExportarExcelGembox(GvTemp, "Reporte de Inventario Fisico - Productos que Sobran " & Now.ToShortDateString, UsuarioActual, "Reporte de Inventario Fisico - Productos que Sobran", DatosFiltros:=SbFiltros.ToString())
|
||||
|
||||
'GvS.ExportToExcel("Reporte de Inventario Fisico - Productos que Sobran " & Now.ToShortDateString)
|
||||
GvTemp.ExportToExcel("Reporte de Inventario Fisico - Productos que Sobran " & Now.ToShortDateString)
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -490,28 +526,62 @@ Partial Class Inventarios_RepAnomalias
|
||||
|
||||
For Each GvRow As GridViewRow In GvTemp.Rows
|
||||
GvRow.BackColor = Drawing.ColorTranslator.FromHtml("white")
|
||||
Next
|
||||
'GvC.ExportToExcel("Reporte de Inventario Fisico - Productos Coincidentes " & Now.ToShortDateString)
|
||||
GvTemp.ExportToExcel("Reporte de Inventario Fisico - Productos Coincidentes " & Now.ToShortDateString)
|
||||
Next
|
||||
|
||||
Dim SbFiltros As New StringBuilder()
|
||||
SbFiltros.AppendFormat("Almacenes: {0}|", LblAlmacenes.Text)
|
||||
SbFiltros.AppendFormat("Fecha Inicio: {0} Fecha Fin: {1}|", lbFechaI.Text, lbFechaF.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Clasificaciones: {0}|", LblClasif.Text)
|
||||
SbFiltros.AppendFormat("Clasificaciones Excluidas: {0}|", LblClasificacionesExcluidas.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Productos: {0}|", LblProductos.Text)
|
||||
SbFiltros.AppendFormat("Productos Excluidos: {0}|", LblProductosExcluidos.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Proveedores: {0}|", LblProveedores.Text)
|
||||
SbFiltros.AppendFormat("SubProyecto: {0}|", lbSubProyecto.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Estatus: {0}|", lbEstatus.Text)
|
||||
|
||||
ExportarExcelGembox(GvTemp, "Reporte de Inventario Fisico - Productos Coincidentes " & Now.ToShortDateString, UsuarioActual, "Reporte de Inventario Fisico - Productos Coincidentes", DatosFiltros:=SbFiltros.ToString())
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub LnkDescarExcelGrupos_Click(sender As Object, e As EventArgs) Handles LnkDescarExcelGrupos.Click
|
||||
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)
|
||||
'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)
|
||||
|
||||
Dim SbFiltros As New StringBuilder()
|
||||
SbFiltros.AppendFormat("Almacenes: {0}|", LblAlmacenes.Text)
|
||||
SbFiltros.AppendFormat("Fecha Inicio: {0} Fecha Fin: {1}|", lbFechaI.Text, lbFechaF.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Clasificaciones: {0}|", LblClasif.Text)
|
||||
SbFiltros.AppendFormat("Clasificaciones Excluidas: {0}|", LblClasificacionesExcluidas.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Productos: {0}|", LblProductos.Text)
|
||||
SbFiltros.AppendFormat("Productos Excluidos: {0}|", LblProductosExcluidos.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Proveedores: {0}|", LblProveedores.Text)
|
||||
SbFiltros.AppendFormat("SubProyecto: {0}|", lbSubProyecto.Text)
|
||||
|
||||
SbFiltros.AppendFormat("Estatus: {0}|", lbEstatus.Text)
|
||||
|
||||
ExportarExcelGembox(GvGrupos, "Reporte de Inventario Fisico" & Now.ToShortDateString, UsuarioActual, "Reporte de Inventario Fisico", DatosFiltros:=SbFiltros.ToString())
|
||||
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
Private Sub BanderaSerieLoteCad(Gv As GridView, resultado As DataTable)
|
||||
If resultado IsNot Nothing Then
|
||||
Gv.Columns(5).Visible = resultado.MAX("CveSeccionAlmacen").ToEntero > 0
|
||||
Gv.Columns(6).Visible = resultado.MAX("Serie") <> ""
|
||||
Gv.Columns(7).Visible = resultado.MAX("Lote") <> ""
|
||||
Gv.Columns(8).Visible = resultado.MAX("FechaCaducidad").ToDate > MinFecha
|
||||
Gv.Columns(6).Visible = resultado.MAX("CveSeccionAlmacen").ToEntero > 0
|
||||
Gv.Columns(7).Visible = resultado.MAX("Serie") <> ""
|
||||
Gv.Columns(8).Visible = resultado.MAX("Lote") <> ""
|
||||
Gv.Columns(9).Visible = resultado.MAX("FechaCaducidad").ToDate > MinFecha
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -710,5 +780,162 @@ Partial Class Inventarios_RepAnomalias
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub ExportarExcelGembox(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)
|
||||
GridView.RenderControl(htw1)
|
||||
|
||||
Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault
|
||||
|
||||
Dim htmlStream1 = New MemoryStream(options.Encoding.GetBytes(sw1.ToString()))
|
||||
|
||||
htmlStream1.Position = 0
|
||||
Dim sr1 As New StreamReader(htmlStream1)
|
||||
Dim myStr1 = sr1.ReadToEnd()
|
||||
sr1.Dispose()
|
||||
htmlStream1.Dispose()
|
||||
sw1.Dispose()
|
||||
|
||||
Dim HtmlCompleto As String = myStr1
|
||||
|
||||
HtmlCompleto = Regex.Replace(HtmlCompleto, "\<[\/]*a[^\>]*\>", "")
|
||||
|
||||
Dim htmlStream5 = New MemoryStream(options.Encoding.GetBytes(HtmlCompleto))
|
||||
|
||||
GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet)
|
||||
|
||||
Dim excel As GemBox.Spreadsheet.ExcelFile
|
||||
|
||||
excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream5, options)
|
||||
|
||||
If Usuario IsNot Nothing Then
|
||||
|
||||
Dim TotalRowHeader As Integer = 6
|
||||
Dim TotalRowFooter As Integer = 2
|
||||
|
||||
|
||||
Dim worksheet = excel.Worksheets(0)
|
||||
worksheet.Rows.InsertEmpty(0, TotalRowHeader)
|
||||
Dim celdasConTexto = worksheet.GetUsedCellRange(True)
|
||||
celdasConTexto.Style.Font.Name = "Calibri Light"
|
||||
|
||||
Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex)
|
||||
RangoNombreEmpresa.Merged = True
|
||||
RangoNombreEmpresa.Value = Usuario.Empresa.Empresa
|
||||
RangoNombreEmpresa.Style.Font.Size = 18 * 20
|
||||
RangoNombreEmpresa.Style.Font.Name = "Calibri Light"
|
||||
RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
|
||||
RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
|
||||
|
||||
|
||||
Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex)
|
||||
RangoTitulo.Merged = True
|
||||
RangoTitulo.Value = Titulo
|
||||
RangoTitulo.Style.Font.Size = 20 * 20
|
||||
RangoTitulo.Style.Font.Name = "Calibri Light"
|
||||
RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
|
||||
RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
|
||||
|
||||
If DatoTituloExtra.Length > 0 Then
|
||||
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.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 RangoDatosFiltro = worksheet.Cells.GetSubrangeAbsolute(TotalRowHeader, celdasConTexto.FirstColumnIndex, TotalRowHeader, celdasConTexto.LastColumnIndex)
|
||||
|
||||
RangoDatosFiltro.Merged = True
|
||||
RangoDatosFiltro.Style.WrapText = True
|
||||
RangoDatosFiltro.Value = TextoFiltro
|
||||
RangoDatosFiltro.Style.Font.Size = 12 * 20
|
||||
RangoDatosFiltro.Style.Font.Name = "Calibri Light"
|
||||
RangoDatosFiltro.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left
|
||||
RangoDatosFiltro.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
|
||||
|
||||
TotalRowHeader += 1
|
||||
Next
|
||||
End If
|
||||
|
||||
'TotalRowHeader += 2
|
||||
|
||||
For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
|
||||
|
||||
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
|
||||
worksheet.Columns(i).AutoFit(1)
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
Dim IndexEndTable As Integer = GridView.Rows.Count + TotalRowHeader + TotalRowFooter
|
||||
|
||||
worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió"
|
||||
worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre
|
||||
|
||||
worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión"
|
||||
worksheet.Rows(IndexEndTable + 1).Cells(2).Value = DateTime.Now.ToString("dd/MM/yyyy")
|
||||
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta))
|
||||
|
||||
If Imagen.Exists Then
|
||||
Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)
|
||||
Using sr As New StreamReader(Ruta)
|
||||
Dim ms As New MemoryStream()
|
||||
sr.BaseStream.CopyTo(ms)
|
||||
worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel)
|
||||
End Using
|
||||
End If
|
||||
|
||||
|
||||
For I = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
|
||||
|
||||
If I > 0 Then
|
||||
|
||||
'If 1 = 1 Then
|
||||
' worksheet.Columns(I + 1).Style.NumberFormat = "#,##0.00"
|
||||
'Else
|
||||
' worksheet.Columns(I + 1).Style.NumberFormat = "#,##"
|
||||
'End If
|
||||
|
||||
worksheet.Columns(I + 1).Style.NumberFormat = "@"
|
||||
|
||||
Try
|
||||
worksheet.Columns(I).AutoFit(1)
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx")
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user