Ciao.
Questo codice genera un file pdf tramite un eseguibile; il problema che il pdf stampa soltanto soltanto l'ultimo dei records presenti nella tabella e non tutti nonostante sia all'interno di un ciclo, potreste aiutarmi? Grazie!
codice:<% Set conn = Server.CreateObject("ADODB.Connection") set rs = Server.CreateObject("ADODB.Recordset") Conn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & server.mappath("/mdb-database/dbx.mdb") & " ; Persist Security Info = False" CmdeHTMLDOC = chr(34)&"c:\HTMLDOC\htmldoc.exe" &_ chr(34)& " -t pdf --quiet "& _ " --webpage -f " Set FSO = Server.CreateObject("Scripting.FileSystemObject") name_fileHTML = "fichier.html" dir = Server.MapPath(name_fileHTML) strSql = "SELECT * FROM tabella" Set objRs = Server.CreateObject("ADODB.Recordset") objRs.Open strSql, Conn, 3, 3 If Not objRs.EOF Then Do While Not objRs.EOF set inF = FSO.OpenTextFile(dir, 2, true) inF.write "<html><body>" &_ "<table border=""1"" width=""100%"">" &_ "<tr>" &_ "<th>ID</th>" &_ "<th>IP</th>" &_ "<th>NAME</th>" &_ "</tr>" &_ "<tr>" &_ "<td>"& objRs("ID") &"</td>" &_ "<td>"& objRs("IP") &"</td>" &_ "<td>"& objRs("NAME") &"</td>" inF.close objRs.MoveNext Loop End If set wshell = Server.CreateObject("wscript.shell") fic_html = dir fic_pdf = Server.MapPath("fichier_test.pdf") wpath = CmdeHTMLDOC &chr(34)& _ fic_pdf &chr(34)&" "& chr(34)& fic_html &chr(34) wshell.Run wpath, SW_SHOWNORMAL, true Set wshell = nothing Response.write "<script>window.document.location.href='" & _ Server.MapPath("fichier_test.pdf") & _ "';</script>" Response.Redirect Server.MapPath("fichier_test.pdf") objRs.Close Set objRs = Nothing Conn.Close Set Conn = Nothing %>

Rispondi quotando