Note that there are some explanatory texts on larger screens.

plurals
  1. POgenerating Excel file error
    text
    copied!<p>I am using the following code in classic ASP to generate Excel file, the code is simple and it works. I run the code under IIS 7.0 on Windows Vista x86. Two issues,</p> <ol> <li>there is a weird warning box, here is the screen snapshot</li> </ol> <p><a href="http://i27.tinypic.com/2n81udw.jpg" rel="nofollow noreferrer">http://i27.tinypic.com/2n81udw.jpg</a></p> <ol start="2"> <li>All cells' background is white, no border of each cell shown, here is the screen snapshot,</li> </ol> <p><a href="http://i25.tinypic.com/vy5t2d.jpg" rel="nofollow noreferrer">http://i25.tinypic.com/vy5t2d.jpg</a></p> <p>My code,</p> <pre><code>&lt;%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%&gt; &lt;% function writeXlsHttpHeaders(filename){ Response.ContentType = "application/vnd.ms-excel"; Response.Charset = "utf-8"; Response.AddHeader("Content-Disposition", "attachment; filename="+filename+".xls"); } function getXlsStart(){ return "" + "&lt;html&gt;\n" + "&lt;head&gt;\n" + "&lt;meta http-equiv=\"Content-Type\" " + "content=\"text/html; charset=UTF-8\"&gt;\n" + "&lt;style type=\"text/css\"&gt;\n" + "html, body, table {\n" + " margin: 0;\n" + " padding: 0;\n" + " font-size: 11pt;\n" + "}\n" + "table, th, td { \n" + " border: 0.1pt solid #D0D7E5;\n" + " border-collapse: collapse;\n" + " border-spacing: 0;\n" + "}\n" + "&lt;/style&gt;\n" + "&lt;/head&gt;\n" + "&lt;body&gt;\n" + "&lt;table&gt;\n" + ""; } function getXlsEnd(){ return "" + "&lt;/table&gt;\n" + "&lt;/body&gt;\n" + "&lt;/html&gt;" + ""; } function xlsEscape(val){ if (typeof val === "number") { return val.toString(10).replace(".", ","); } else if (typeof val === "string") { return Server.HTMLEncode(val); } else if (val === null) { return "#NULL#"; } else if (val === undefined) { return "#UNDEFINED#"; } else { return "#ERROR#"; } } function writeXls(filename, data, columnCount){ writeXlsHttpHeaders(filename); Response.Write(getXlsStart()); var columnCount = 2; for (var i=0, il=10; i&lt;il; i+=columnCount) { Response.Write("&lt;tr&gt;"); for (var j=0; j&lt;columnCount; j++) { Response.Write("&lt;td&gt;"); Response.Write(xlsEscape("Data")); Response.Write("&lt;/td&gt;"); } Response.Write("&lt;/tr&gt;\n"); // prevent Response Buffering Limit Exceeded if (i % 1000 === 0) { Response.Flush(); } } Response.Write(getXlsEnd()); } function main(){ var filetype = Request.QueryString("filetype")(); var filename = "filename"; Response.Clear(); writeXls(filename); Response.End(); } main(); %&gt; </code></pre> <p>Any solutions?</p> <p>thanks in advance, George</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload