function getTableDataByXML(inTable
var rows =
//alert("getTblData is " + inWindow);
var tblDocument = document;
if (!!inWindow && inWindow != "") {
if (!document
return null;
}
else {
tblDocument = eval(inWindow)
}
}
var inTbl = tblDocument
var outStr = "<?xml version="
outStr = outStr + "<?mso
outStr = outStr + "<Workbook xmlns="urn:schemas
outStr = outStr + " xmlns:o="urn:schemas
outStr = outStr + " xmlns:x="urn:schemas
outStr = outStr + " xmlns:ss="urn:schemas
outStr = outStr + "<Worksheet ss:Name="Sheet
outStr = outStr + "<Table ss:ExpandedColumnCount="
var re = /^[
if (inTbl != null) {
for (var j =
outStr += "<Row ss:AutoFitHeight="
for (var i =
if (i ==
outStr += "<Cell><Data ss:Type="String"></Data></Cell>n";
rows
}
var cellValue = inTbl
//小於
if(re
outStr = outStr + "<Cell><Data ss:Type="Number">" + cellValue + "</Data></Cell>n";
}else{
outStr = outStr + "<Cell><Data ss:Type="String">" + cellValue + "</Data></Cell>n";
}
if (inTbl
for (var k =
outStr += " <Cell><Data ss:Type="String"></Data></Cell>n";
}
}
if (i ==
if (rows ==
rows = inTbl
}
}
}
outStr += "</Row>n";
}
}
else {
outStr = null;
alert("你要導出的表不存在!!");
return;
}
outStr = outStr + "</Table>n</Worksheet>n</Workbook>";
return outStr;
}
上述函數原本是導出txt文件的函數
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20186.html