Respuesta: Problema al Generar Archivo excel desde ASP lo hice y el excel ya no se "cae" pero me imprime el error en el excel generado
<font face="Arial" size=2>
<p>Microsoft VBScript runtime </font> <font face="Arial" size=2>error '800a005e'</font>
<p>
<font face="Arial" size=2>Invalid use of Null: 'replace'</font>
<p>
<font face="Arial" size=2>/revision_polizas/Consulta/consultapendientesysiniestro/archivosiniestro.asp</font><font face="Arial" size=2>, line 58</font>
------------------------------------------------
adjunto el codigo
<!-- #include file="lib/conexion.asp" -->
<%Response.Expires=0
server.ScriptTimeout=57600
response.Clear()
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
strLCID = 7177
session.LCID = strLCID
conectar
sql = request("consulta")
sql = replace(sql,"*","%")
'response.Write(sql)
'response.End()
ejec(sql)
Response.Buffer = true
Response.ContentType = "application/vnd.ms-excel"
Dim r, r_ini, oSS, oInformesSheet, oRange, c, numero_hojas, reg
dim nro_siniestro_corredora, rut, dv, nombre, apellidop, apellidom, fecha_siniestro, fec_ingreso, tipo_siniestro, seguro, estado, fecha_pago, total_pagado
set oSS = CreateObject("OWC10.Spreadsheet")
Set c = oSS.Constants
Dim sql
dim fec,pol,nom,dir,com
oSS.Worksheets(3).delete
oSS.Worksheets(2).delete
numero_hojas = 1
call generaEncabezado()
r_ini = r
if reg.eof = true then
Set oRange = oInformesSheet.Range("C3")
oRange.Value = Array("No Hay Datos Para Hoy")
call terminar()
else
reg.movefirst
do until reg.eof
nro_siniestro_corredora = reg(1)
rut = reg(2)
dv = reg(3)
nombre = replace(replace(replace(replace(replace(replace(re place(reg(4),chr(209),"N"),chr(241),"n"),"á","a"), "é","e"),"í","i"),"ó","o"),"ú","u")
apellidop = replace(replace(replace(replace(replace(replace(re place(reg(5),chr(209),"N"),chr(241),"n"),"á","a"), "é","e"),"í","i"),"ó","o"),"ú","u")
apellidom = replace(replace(replace(replace(replace(replace(re place(reg(6),chr(209),"N"),chr(241),"n"),"á","a"), "é","e"),"í","i"),"ó","o"),"ú","u")
fecha_siniestro = reg(8)
fec_ingreso = reg(16)
tipo_siniestro = replace(replace(replace(replace(replace(replace(re place(reg(0),chr(209),"N"),chr(241),"n"),"á","a"), "é","e"),"í","i"),"ó","o"),"ú","u")
seguro = replace(replace(replace(replace(replace(replace(re place(reg(15),chr(209),"N"),chr(241),"n"),"á","a") ,"é","e"),"í","i"),"ó","o"),"ú","u")
estado = replace(replace(replace(replace(replace(replace(re place(reg(27),chr(209),"N"),chr(241),"n"),"á","a") ,"é","e"),"í","i"),"ó","o"),"ú","u")
fecha_pago = reg(30)
total_pagado = reg(31)
Set oRange = oInformesSheet.Range("A" & r & ":M" & r)
oRange.Value = Array(nro_siniestro_corredora, rut, dv, nombre, apellidop, apellidom, fecha_siniestro, fec_ingreso, tipo_siniestro, seguro, estado, fecha_pago, total_pagado)
oRange.Font.Size = 8
With oRange.Borders(7)
.LineStyle = 1
.Weight = 2
End With
With oRange.Borders(8)
.LineStyle = 1
.Weight = 2
End With
With oRange.Borders(9)
.LineStyle = 1
.Weight = 2
End With
With oRange.Borders(10)
.LineStyle = 1
.Weight = 2
End With
With oRange.Borders(11)
.LineStyle = 1
.Weight = 2
End With
r = r + 1
response.Flush()
response.Clear()
reg.MoveNext
loop
end if
reg.Close
call terminar()
sub GeneraEncabezado()
r=1
Set oInformesSheet = oSS.Worksheets(numero_hojas)
oInformesSheet.Name = "hoja 1"
Set oRange = oInformesSheet.Range("A1:M1")
oRange.Value = Array("Numero Siniestro Corredora","RUT","DV","Nombre Cliente", "Apellido Paterno","Apellido Materno","Fecha Siniestro","Fecha Ingreso Corredora","Tipo Siniestro","Seguro","Estado","Fecha de Pago","Total Pagado")
With oRange.Borders(7)
.LineStyle = 1
.Weight = 2
End With
With oRange.Borders(8)
.LineStyle = 1
.Weight = 2
End With
With oRange.Borders(9)
.LineStyle = 1
.Weight = 2
End With
With oRange.Borders(10)
.LineStyle = 1
.Weight = 2
End With
With oRange.Borders(11)
.LineStyle = 1
.Weight = 2
End With
oRange.Font.Bold = True
oRange.Interior.Color = "Silver"
oRange.HorizontalAlignment = c.xlHAlignCenter
call FormateaColumnas()
r = 2
end sub
sub FormateaColumnas()
oInformesSheet.Range("A:A").ColumnWidth = 11
oInformesSheet.Range("B:B").ColumnWidth = 35
oInformesSheet.Range("C:C").ColumnWidth = 10
oInformesSheet.Range("D:D").ColumnWidth = 15
'oInformesSheet.Range("C:C").NumberFormat = "0"
oInformesSheet.Range("E:E").ColumnWidth = 15
'oInformesSheet.Range("E:E").NumberFormat ="d-m-yyyy"
oInformesSheet.Range("F:F").ColumnWidth = 18
oInformesSheet.Range("G:G").ColumnWidth = 20
oInformesSheet.Range("G:G").NumberFormat ="d-m-yyyy"
oInformesSheet.Range("H:H").ColumnWidth = 25
oInformesSheet.Range("H:H").NumberFormat ="d-m-yyyy"
oInformesSheet.Range("I:I").ColumnWidth = 15
oInformesSheet.Range("J:J").ColumnWidth = 35
oInformesSheet.Range("K:K").ColumnWidth = 50
oInformesSheet.Range("L:L").ColumnWidth = 35
oInformesSheet.Range("L:L").NumberFormat ="d-m-yyyy"
oInformesSheet.Range("M:M").ColumnWidth = 35
oInformesSheet.Range("A1:M1" & r & "").Font.Size = 8
oSS.Windows(1).ViewableRange = oInformesSheet.UsedRange.Address
end sub
sub terminar()
oInformesSheet.Activate
oSS.Windows(1).ViewableRange = oInformesSheet.UsedRange.Address
oSS.DisplayToolbar = True
oSS.AutoFit = false
oInformesSheet.Protection.Enabled = false
oInformesSheet.Activate
Response.Write oSS.XMLData
Response.End
end sub
%> |