IdcDepositListExcel.jsp change...
This commit is contained in:
parent
d314477a3c
commit
3664ac0ac1
@ -8,10 +8,13 @@ var tableToExcel = (function(){
|
||||
, 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>'
|
||||
, base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
|
||||
, format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
|
||||
return function(table, name) {
|
||||
return function(table, name, filename) {
|
||||
if (!table.nodeType) table = document.getElementById(table)
|
||||
var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
|
||||
window.location.href = uri + base64(format(template, ctx))
|
||||
//window.location.href = uri + base64(format(template, ctx))
|
||||
document.getElementById("dlink").href = uri + base64(format(template, ctx));
|
||||
document.getElementById("dlink").download = filename;
|
||||
document.getElementById("dlink").click();
|
||||
}
|
||||
})();
|
||||
|
||||
@ -40,7 +43,7 @@ function validateTest(){
|
||||
<input class="form-control" type="text" name="searchContent" placeholder="고객명" value="${searchContent }">
|
||||
<div class="input-group-btn">
|
||||
<input type="submit" class="btn btn-info btn-outline" value="검색">
|
||||
<a class="btn btn-outline btn-default" onclick="tableToExcel('table','name')">엑셀 출력</a>
|
||||
<a class="btn btn-outline btn-default" onclick="tableToExcel('table','name','itsolution_incomelist.xls')">엑셀 출력</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -48,6 +51,7 @@ function validateTest(){
|
||||
</div>
|
||||
<!-- row -->
|
||||
<input type="hidden" id="token">
|
||||
<a id="dlink" style="display:none;"></a>
|
||||
<div class="table-responsive" id="table">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user