Inquiridor
EXPORT RELATÓRIO ASP PARA EXCEL

Pergunta
-
Pessoal,
Preciso de um help!!!
Ao exportar um relatorio ASP para o excel, o arquivo excel abre em branco e mesmo salvar como também abre em branco. Jah testei em vários sistemas operacionais. O que pode estar errado?
Abaixo o código para verificação.
Obrigada,
Code Snippet
<%
function converteValoresBR(valor,formataNum)
dim MyBrow
dim Sistema
Set MyBrow=Server.CreateObject("MSWC.BrowserType")
Sistema = MyBrow.platform
if valor=empty then
valor="0"
end if
if valor <> empty then
valor = FormatNumber(valor,2)
valor = replace(valor,",","")
if trim(formataNum)="1" or ucase(Sistema)=ucase("Win95") or ucase(Sistema)=ucase("Win98") or ucase(Sistema)=ucase("unknown")or ucase(Sistema)=ucase("WinVista") or ucase(Sistema)=ucase("WinXP")then
valor = replace(valor,".",",")
end if
converteValoresBR = valor
end if
end functiondim SqlConsultaExcel
Dim objRst ' ADO Recordset Object
dim bgColor
dim formataNumeroSqlConsultaExcel = Session("sql")
formataNumero = Request.QueryString("formataNum")Set objRst = Server.CreateObject("ADODB.RecordSet")
objRst.Open SqlConsultaExcel, conn_string , adOpenStatic, adLockReadOnly
'Set objRst = obterRecordset(SqlConsultaExcel)
if not objRst.eof then
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"Response.Write "<table width='773'"
Response.Write "style='border: thin solid rgb(0,0,0)'>"
Response.Write "<tr bgcolor='#99CC99' >"
Response.Write "<td width=120><font class=12 size=1><strong>Contrato</strong></font></td>"
Response.Write "<td width=130><font class=12 size=1><strong>Cliente</strong></font></td>"
Response.Write "<td width=80><font class=12 size=1><strong>Designação<br></strong></font></td>"
Response.Write "<td width=60><font class=12 size=1><strong>Veloc</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1 ><strong>Coord Implant</strong></font></td>"
Response.Write "<td width=75><font class=12 size=1 ><strong>Loc/Exec/PtoA/UF</strong></font></td>"
Response.Write "<td width=75><font class=12 size=1> <strong>Loc/Exec/PtoB/UF</strong></font></td>"
Response.Write "<td width=90><font class=12 size=1><strong>Serviço</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Org Ven</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Pend A</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Pend B</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Cod</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>CS</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Pendência CS</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Status</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Ação</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>GECS</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Valor Backlog</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Origem Valor</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Dias Pend</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Data ForeCast</strong></font></td>"
Response.Write "</tr>"objRst.MoveFirst
Do while not objRst.eof
bgColor="#aaccbb"
if (trim(objRst("agenteA")) = trim(Session("cod_usuario")) or _
trim(objRst("agenteB")) = trim(Session("cod_usuario")) or _
trim(objRst("agenteCoord")) = trim(Session("cod_usuario"))) then
if objRst("pontab_ser")=true then
if isnull(objRst("cod_tippenreal_A")) or isnull(objRst("cod_tippenreal_B")) then
if isnull(objRst("cnl_locB")) then
bgColor="#aaccbb"
else
bgColor="#ffdead"
end if
else
bgColor="#aaccbb"
end if
else
if isnull(objRst("cod_tippenreal_A")) then
bgColor="#ffdead"
else
bgColor="#aaccbb"
end if
end if
if isnull(ObjRst("data_cadastro_cir")) then
bgColor="#87ceeb"
end if
else
bgColor="#aaccbb"
end if
if trim(objRst("cod_acao_cir")) = trim(DESATIVAR) then
bgColor="#cccccc"
end ifResponse.Write "<tr bgcolor="&bgColor&">"
Response.Write "<td><font class=12 size=1>"&objRst("contrato_cir")&"</font></td>"
Response.Write "<td><font class=12 size=1>"&objRst("nome_fantasia_cli")&"</font></td>"
Response.Write "<td><font class=12 size=1>"&objRst("designacao_cir")&"</font></td>"Response.Write "<td><font class=12 size=1>"&objRst("padrao_veloc")&"</font></td>"
Response.Write "<td><font class=12 size=1>"&objRst("cnl_locC")&"</font></td>"
Response.Write "<td><font class=12 size=1>"&objRst("locA")&"/"&objRst("cnl_locA")&"/"&objRst("ptoCvpA")&"/"&objRst("uf_a")&"</font></td>"Response.Write "<td><font class=12 size=1>"
if (objRst("pontaB_ser")) then
response.write(objRst("locB")&"/"&objRst("cnl_locB")&"/"&objRst("ptoCvpB")&"/"&objRst("uf_b"))
else
response.write("-")
end if
Response.Write "</font></td>"Response.Write "<td><font class=12 size=1>"&objRst("descricao_ser")&"</font></td>"
Response.Write "<td><font class=12 size=1>"&objRst("sigla_orgven")&"</font></td>"
Response.Write "<td><font class=12 size=1>"
if (not isnull(objRst("cod_tippenreal_A"))) and (objRst("cod_tippenreal_A")<>0) then
response.write(objRst("cod_tippenreal_A"))
else
Response.Write " "
end if
if (not isnull(objRst("cod_subtippenreal_A"))) and (objRst("cod_subtippenreal_A")<>0) then
response.write("."&objRst("cod_subtippenreal_A"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if (not isnull(objRst("cod_tippenreal_B"))) and (objRst("cod_tippenreal_B")<>0) then
response.write(objRst("cod_tippenreal_B"))
else
Response.Write " "
end if
if (not isnull(objRst("cod_subtippenreal_B"))) and (objRst("cod_subtippenreal_B")<>0) then
response.write("."&objRst("cod_subtippenreal_B"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if (not isnull(objRst("cod_cir"))) then
response.write(objRst("cod_cir"))
else
Response.Write " "
end if
response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("userid_cs")) then
response.write(ucase(objRst("userid_cs")))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("pendencia_cs")) then
response.write(objRst("pendencia_cs"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("status")) then
response.write(objRst("status"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("acao")) then
response.write(objRst("acao"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("GECS")) then
response.write(objRst("GECS"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("valor_backlog_cir")) then
Response.Write(converteValoresBR(objRst("valor_backlog_cir"),formataNumero))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("origem_valor_cir")) then
Response.Write(objRst("origem_valor_cir"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("dias_pendentes")) then
Response.Write(objRst("dias_pendentes"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("data_forcast")) then
Response.Write(objRst("data_forcast"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "</tr>"objRst.MoveNext
If objRst.EOF Then
Exit do
End If
Loop
set objRst = nothing
Response.Write "</table>"
else
response.write ("<p> </p>")
response.write ("<p> </p>")
response.write ("<center><h2>Não foram encontrados registros que coincidam com a pesquisa.</h2></center>")
if Session("cons")<>1 then
response.write ("<br><center><h3><input type=image src='../images/botoes/b_voltar.jpg' onclick=parent.document.location.href='../menu_principal/menu_princ.asp'></h4></center>")
end if
end if
%>///////TRANSFERE PARA O EXCEL////////////
<%
function converteValoresBR(valor,formataNum)
dim MyBrow
dim Sistema
Set MyBrow=Server.CreateObject("MSWC.BrowserType")
Sistema = MyBrow.platform
if valor=empty then
valor="0"
end if
if valor <> empty then
valor = FormatNumber(valor,2)
valor = replace(valor,",","")
if trim(formataNum)="1" or ucase(Sistema)=ucase("Win95") or ucase(Sistema)=ucase("Win98") or ucase(Sistema)=ucase("unknown")or ucase(Sistema)=ucase("WinXP")then
valor = replace(valor,".",",")
end if
converteValoresBR = valor
end if
end functiondim SqlConsultaExcel
Dim objRst ' ADO Recordset Object
dim bgColor
dim formataNumeroSqlConsultaExcel = Session("sql")
formataNumero = Request.QueryString("formataNum")Set objRst = Server.CreateObject("ADODB.RecordSet")
objRst.Open SqlConsultaExcel, conn_string , adOpenStatic, adLockReadOnly
'Set objRst = obterRecordset(SqlConsultaExcel)
if not objRst.eof then
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"Response.Write "<table width='773'"
Response.Write "style='border: thin solid rgb(0,0,0)'>"
Response.Write "<tr bgcolor='#99CC99' >"
Response.Write "<td width=120><font class=12 size=1><strong>Contrato</strong></font></td>"
Response.Write "<td width=130><font class=12 size=1><strong>Cliente</strong></font></td>"
Response.Write "<td width=80><font class=12 size=1><strong>Designação<br></strong></font></td>"
Response.Write "<td width=60><font class=12 size=1><strong>Veloc</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1 ><strong>Coord Implant</strong></font></td>"
Response.Write "<td width=75><font class=12 size=1 ><strong>Loc/Exec/PtoA/UF</strong></font></td>"
Response.Write "<td width=75><font class=12 size=1> <strong>Loc/Exec/PtoB/UF</strong></font></td>"
Response.Write "<td width=90><font class=12 size=1><strong>Serviço</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Org Ven</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Pend A</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Pend B</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Cod</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>CS</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Pendência CS</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Status</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Ação</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>GECS</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Valor Backlog</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Origem Valor</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Dias Pend</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Data ForeCast</strong></font></td>"
Response.Write "</tr>"objRst.MoveFirst
Do while not objRst.eof
bgColor="#aaccbb"
if (trim(objRst("agenteA")) = trim(Session("cod_usuario")) or _
trim(objRst("agenteB")) = trim(Session("cod_usuario")) or _
trim(objRst("agenteCoord")) = trim(Session("cod_usuario"))) then
if objRst("pontab_ser")=true then
if isnull(objRst("cod_tippenreal_A")) or isnull(objRst("cod_tippenreal_B")) then
if isnull(objRst("cnl_locB")) then
bgColor="#aaccbb"
else
bgColor="#ffdead"
end if
else
bgColor="#aaccbb"
end if
else
if isnull(objRst("cod_tippenreal_A")) then
bgColor="#ffdead"
else
bgColor="#aaccbb"
end if
end if
if isnull(ObjRst("data_cadastro_cir")) then
bgColor="#87ceeb"
end if
else
bgColor="#aaccbb"
end if
if trim(objRst("cod_acao_cir")) = trim(DESATIVAR) then
bgColor="#cccccc"
end ifResponse.Write "<tr bgcolor="&bgColor&">"
Response.Write "<td><font class=12 size=1>"&objRst("contrato_cir")&"</font></td>"
Response.Write "<td><font class=12 size=1>"&objRst("nome_fantasia_cli")&"</font></td>"
Response.Write "<td><font class=12 size=1>"&objRst("designacao_cir")&"</font></td>"Response.Write "<td><font class=12 size=1>"&objRst("padrao_veloc")&"</font></td>"
Response.Write "<td><font class=12 size=1>"&objRst("cnl_locC")&"</font></td>"
Response.Write "<td><font class=12 size=1>"&objRst("locA")&"/"&objRst("cnl_locA")&"/"&objRst("ptoCvpA")&"/"&objRst("uf_a")&"</font></td>"Response.Write "<td><font class=12 size=1>"
if (objRst("pontaB_ser")) then
response.write(objRst("locB")&"/"&objRst("cnl_locB")&"/"&objRst("ptoCvpB")&"/"&objRst("uf_b"))
else
response.write("-")
end if
Response.Write "</font></td>"Response.Write "<td><font class=12 size=1>"&objRst("descricao_ser")&"</font></td>"
Response.Write "<td><font class=12 size=1>"&objRst("sigla_orgven")&"</font></td>"
Response.Write "<td><font class=12 size=1>"
if (not isnull(objRst("cod_tippenreal_A"))) and (objRst("cod_tippenreal_A")<>0) then
response.write(objRst("cod_tippenreal_A"))
else
Response.Write " "
end if
if (not isnull(objRst("cod_subtippenreal_A"))) and (objRst("cod_subtippenreal_A")<>0) then
response.write("."&objRst("cod_subtippenreal_A"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if (not isnull(objRst("cod_tippenreal_B"))) and (objRst("cod_tippenreal_B")<>0) then
response.write(objRst("cod_tippenreal_B"))
else
Response.Write " "
end if
if (not isnull(objRst("cod_subtippenreal_B"))) and (objRst("cod_subtippenreal_B")<>0) then
response.write("."&objRst("cod_subtippenreal_B"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if (not isnull(objRst("cod_cir"))) then
response.write(objRst("cod_cir"))
else
Response.Write " "
end if
response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("userid_cs")) then
response.write(ucase(objRst("userid_cs")))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("pendencia_cs")) then
response.write(objRst("pendencia_cs"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("status")) then
response.write(objRst("status"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("acao")) then
response.write(objRst("acao"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("GECS")) then
response.write(objRst("GECS"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("valor_backlog_cir")) then
Response.Write(converteValoresBR(objRst("valor_backlog_cir"),formataNumero))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("origem_valor_cir")) then
Response.Write(objRst("origem_valor_cir"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("dias_pendentes")) then
Response.Write(objRst("dias_pendentes"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "<td><font class=12 size=1>"
if not isnull(objRst("data_forcast")) then
Response.Write(objRst("data_forcast"))
else
Response.Write " "
end if
Response.Write "</font></td>"
Response.Write "</tr>"objRst.MoveNext
If objRst.EOF Then
Exit do
End If
Loop
set objRst = nothing
Response.Write "</table>"
else
response.write ("<p> </p>")
response.write ("<p> </p>")
response.write ("<center><h2>Não foram encontrados registros que coincidam com a pesquisa.</h2></center>")
if Session("cons")<>1 then
response.write ("<br><center><h3><input type=image src='../images/botoes/b_voltar.jpg' onclick=parent.document.location.href='../menu_principal/menu_princ.asp'></h4></center>")
end if
end if
%>
Todas as Respostas
-
Vivian,
Não cheguei a analisar o seu código, mas sempre que quero exportar uma página para excel ou word faço isso e funciona:
Você faz o link em sua pagina, tipo: Gerar Excel:
<a href="pagina.asp?Acao=Criar> Gerar Excel</a>
E na página pagina.asp (que pode ser a mesa onde estar o link), coloque:
Acao = request.querystring("Acao")
if Acao="Criar" then
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment;filename=Relatorio.xls"end if
Pode fazer isso para outros arquivos mudando só o ContentType para:
application/msword = Word
application/vnd.ms-excel = Excel
application/vnd.ms-powerpoint = Power Point
application/pdf = PDF
application/x-zip-compressed = ZIP
image/GIF = GIF
image/JPEG = JPEG
image/bmp = BMP
text/HTML = HTML
text/vnd.wap.wml = WMLÉ por aí... se usar esse exemplo com calma ele saí...
Espero ter ajudado. Não esqueça de marcar se foi útil a respota.
-
Marcelo, o teste que vc me mandou o meu código já está fazendo, porém abre o excel dentro da página.
Dah uma olhada no código.
Preciso que essas informações sejam enviadas e o relatorio. xls aparece em branco igual ao meu.
É exibido um relatorio na página, daih eu clico num link para exibir esse relatorio para o excel. Só que o excel está abrindo em branco.
Obrigada,
Code SnippetSqlConsultaExcel = Session("sql")
formataNumero = Request.QueryString("formataNum")Set objRst = Server.CreateObject("ADODB.RecordSet")
objRst.Open SqlConsultaExcel, conn_string , adOpenStatic, adLockReadOnly
'Set objRst = obterRecordset(SqlConsultaExcel)
if not objRst.eof then
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"Response.Write "<table width='773'"
Response.Write "style='border: thin solid rgb(0,0,0)'>"
Response.Write "<tr bgcolor='#99CC99' >"
Response.Write "<td width=120><font class=12 size=1><strong>Contrato</strong></font></td>"
Response.Write "<td width=130><font class=12 size=1><strong>Cliente</strong></font></td>"
Response.Write "<td width=80><font class=12 size=1><strong>Designação<br></strong></font></td>"
Response.Write "<td width=60><font class=12 size=1><strong>Veloc</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1 ><strong>Coord Implant</strong></font></td>"
Response.Write "<td width=75><font class=12 size=1 ><strong>Loc/Exec/PtoA/UF</strong></font></td>"
Response.Write "<td width=75><font class=12 size=1> <strong>Loc/Exec/PtoB/UF</strong></font></td>"
Response.Write "<td width=90><font class=12 size=1><strong>Serviço</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Org Ven</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Pend A</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Pend B</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Cod</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>CS</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Pendência CS</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Status</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Ação</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>GECS</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Valor Backlog</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Origem Valor</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Dias Pend</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Data ForeCast</strong></font></td>"
Response.Write "</tr>" -
Marcelo, o teste que vc me mandou o meu código já está fazendo, porém abre o excel dentro da página.
Dah uma olhada no código.
Preciso que essas informações sejam enviadas e o relatorio. xls aparece em branco igual ao meu.
É exibido um relatorio na página, daih eu clico num link para exibir esse relatorio para o excel. Só que o excel está abrindo em branco.
Obrigada,
Code SnippetSqlConsultaExcel = Session("sql")
formataNumero = Request.QueryString("formataNum")Set objRst = Server.CreateObject("ADODB.RecordSet")
objRst.Open SqlConsultaExcel, conn_string , adOpenStatic, adLockReadOnly
'Set objRst = obterRecordset(SqlConsultaExcel)
if not objRst.eof then
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"Response.Write "<table width='773'"
Response.Write "style='border: thin solid rgb(0,0,0)'>"
Response.Write "<tr bgcolor='#99CC99' >"
Response.Write "<td width=120><font class=12 size=1><strong>Contrato</strong></font></td>"
Response.Write "<td width=130><font class=12 size=1><strong>Cliente</strong></font></td>"
Response.Write "<td width=80><font class=12 size=1><strong>Designação<br></strong></font></td>"
Response.Write "<td width=60><font class=12 size=1><strong>Veloc</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1 ><strong>Coord Implant</strong></font></td>"
Response.Write "<td width=75><font class=12 size=1 ><strong>Loc/Exec/PtoA/UF</strong></font></td>"
Response.Write "<td width=75><font class=12 size=1> <strong>Loc/Exec/PtoB/UF</strong></font></td>"
Response.Write "<td width=90><font class=12 size=1><strong>Serviço</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Org Ven</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Pend A</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Pend B</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Cod</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>CS</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Pendência CS</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Status</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>Ação</strong></font></td>"
Response.Write "<td width=40><font class=12 size=1><strong>GECS</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Valor Backlog</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Origem Valor</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Dias Pend</strong></font></td>"
Response.Write "<td width=50><font class=12 size=1><strong>Data ForeCast</strong></font></td>"
Response.Write "</tr>" -
Marcelo, dessa forma funcionou + - ....
porém, não abriu excel, abriu o relatorio como se fosse HTML na propria pagina.
Acao = request.querystring("Acao")
if Acao="Criar" then
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment;filename=Relatorio.xls"end if
-
Desculpe a demora, é o corre-corre...
Você tem um link para ver isso na prática ? Pelo que entendi você está abrindo uma pagina em branca com esse link para gerar o relatório... Mas, quando eu faço o meu é diferente...
Abrao uma pagina com os dados sendo exibidos lá e nele mesmo tem um botão para abrir em excel ou word... nele clico e assim ele abre com as informações no word ou execel... fez assim?
-
Galera, eu entendi o que ela quer e eu estou com o mesmo problema e nada na net resolve.
Tipo eu gerei meu relatório em html normal, exibiu as informações na tela, embaixo dele quero que apareça um botão "Gerar para Excel", mas ai começa o problema, eu quero q quando eu clicar no Gerar Excel apareça aquela tela do windows para eu escolher o local aonde vou salvar o arquivo em Excel. Assim mantendo meu relatório em html na página.
Na forma descrita acima ele abre o excel direto na página em que ele está, isso eu não quero pois não é funcional.
O ideal é aproveitar as informações que estão na tela para exportar, pois existem outras opções que fazem com que eu redirecione para outra página e assim faço a consulta novamente, porém essa minha consulta é pesada e re-fazer ela não seria a melhor forma.
Valew pessoal!!!