最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jquery使用jxl插件導(dǎo)出excel示例

 更新時間:2014年04月14日 15:42:50   作者:  
這篇文章主要介紹了jquery使用jxl插件導(dǎo)出excel的具體實現(xiàn)步驟,需要的朋友可以參考下
復(fù)制代碼 代碼如下:

function formattable(tableHtml, sheetName) {
var template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>';
var ctx = {
worksheet : name,
table : tableHtml
};
var downloadLink = document.createElement("a");
downloadLink.href = 'data:application/vnd.ms-excel;base64,' + base64(format(
template, ctx));
downloadLink.download = sheetName + ".xls";
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
// window.open('data:application/vnd.ms-excel;base64,'+
// base64(format(template, ctx)));
}


function base64(s) {
return $.base64.btoa(unescape(encodeURIComponent(s)));
}


var format = function(s, c) {
return s.replace(/{(\w+)}/g, function(m, p) {
return c[p];
});
}

相關(guān)文章

最新評論

晋州市| 泸州市| 常山县| 略阳县| 察隅县| 安龙县| 景德镇市| 大渡口区| 东乡族自治县| 丰顺县| 涡阳县| 九龙县| 于田县| 九龙城区| 左权县| 吉林市| 临潭县| 公主岭市| 大关县| 定结县| 淄博市| 林芝县| 丹巴县| 台北县| 淮滨县| 班戈县| 珠海市| 福鼎市| 晋宁县| 葫芦岛市| 蓬安县| 大渡口区| 威信县| 宜川县| 安顺市| 呼伦贝尔市| 育儿| 巩留县| 三河市| 九龙坡区| 黎川县|