You generated HTML needs to use http references to the CSS files. For example:
<link rel="stylesheet" type="text/css" href="resources/yui/yui.css">
Of course the css file nees to be in the appropriate directory
Question
After running the following code, at the time of generating CSV output in excel file, I'm getting following error:
Problems during Load:
Missing file: C:\CFIDE\scripts\ajax\resources\yui\yui.css
Missing File: C:\CFIDE\scripts\ajax\resources\cf\cf.css
The code I'm running is as follows:
<CFHEADER NAME="Content-Disposition" VALUE="inline; filename=stats.xls">
<cfcontent type="application/msexcel"><cfoutput>#Query2Excel(qONEQUERY)#</cfoutput>
Here is the Query2Excel function:
function Query2Excel(query) {
var InputColumnList = query.columnList;
var Headers = query.columnList;
var AlternateColor = "FFFFFF";
var header = "";
var headerLen = 0;
var col = "";
var colValue = "";
var colLen = 0;
var i = 1;
var j = 1;
var k = 1;
var HTMLData = "";
if (arrayLen(arguments) gte 2) {
Headers = arguments[2];
}
if (arrayLen(arguments) gte 3) {
InputColumnList = arguments[3];
}
if (arrayLen(arguments) gte 4) {
AlternateColor = arguments[4];
}
if (listLen(InputColumnList) neq listLen(Headers)) {
return "Input Column list and Header list are not of equal length";
}
HTMLData = HTMLData & "<table border=1><tr bgcolor=""C0C0C0"">";
for (i=1;i lte ListLen(Headers);i=i+1){
header=listGetAt(Headers,i);
headerLen=Len(header)*10;
HTMLData = HTMLData & "<th width=""#headerLen#""><b>#header#</b></th>";
}
HTMLData = HTMLData & "</tr>";
for (j=1;j lte query.recordcount;j=j+1){
if (j mod 2) {
HTMLData = HTMLData & "<tr bgcolor=""FFFFFF"">";
} else {
HTMLData = HTMLData & "<tr bgcolor=""#alternatecolor#"">";
}
for (k=1;k lte ListLen(InputColumnList);k=k+1) {
col=ListGetAt(InputColumnList,k);
colValue=query[trim(col)][j];
colLength=Len(colValue)*10;
if (NOT Len(colValue)) {
colValue=" ";
}
if (isNumeric(colValue) and Len(colValue) gt 10) {
colValue="'#colValue#";
}
HTMLData = HTMLData & "<td width=""#colLength#"">#colValue#</td>";
}
HTMLData = HTMLData & "</tr>";
}
HTMLData = HTMLData & "</table>";
return HTMLData;
}
</cfscript>
Solution
You generated HTML needs to use http references to the CSS files. For example:
<link rel="stylesheet" type="text/css" href="resources/yui/yui.css">
Of course the css file nees to be in the appropriate directory