function getTableDataByXML(inTable, inWindow) {
var rows = 0;
//alert("getTblData is " inWindow);
var tblDocument = document;
if (! !inWindow && inWindow != "") {
if (!document.all(inWindow)) {
else {
tblDocument = eval(inWindow).document ;
}
}
var inTbl = tblDocument.getElementById(inTable); ? "n";
outStr = outStr " outStr = outStr " xmlns :o="urn:schemas-microsoft-com:office:office"";
outStr = outStr " xmlns:x="urn:schemas-microsoft-com:office:excel"";
outStr = outStr " xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">n";
outStr = outStr "n";
outStr = outStr "
n";
var re = /^[0-9] .?[0-9]*$/; // 是否為數字
if (inTbl != null) {
for (var j = 0; j He 0">n";
for (var i = 0; i 🎜> outStr = " | n";
var cellValue = inTbl.rows[j ].cells[i].innerText;
//小於12 位數字使用Number
🎜> outStr = outStr "" cellValue "n";
" cellValue " | n";
}
> for (var k = 0; inTbl.rows[j].cells[i].colSpan - k ) {
>n";
}
if (i == 0) {
) {
rows = inTbl.rows[j]. cells[i].rowSpan - 1;
}
}
}
outStr = "n";
}
outStr = null;
alert("你要匯出的表不存在!!");
return;
Workbook>";
return outStr;
}
上述函數原本是匯出txt檔案的函數。把excel文件另存為一個xml文件,就可以得到excel能辨識什麼內容格式的xml檔。