IdcDepositListExcel.jsp change...

This commit is contained in:
최준흠 2022-03-25 10:33:58 +09:00
parent 33b8ad0723
commit adb7dffd3e

View File

@ -8,13 +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>' , 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))) } , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
, format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) } , 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) if (!table.nodeType) table = document.getElementById(table)
var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML} 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").href = uri + base64(format(template, ctx));
document.getElementById("dlink").download = filename; document.getElementById("dlink").download = filename;
document.getElementById("dlink").click(); document.getElementById("dlink").click();
} }
})(); })();
@ -43,7 +43,7 @@ function validateTest(){
<input class="form-control" type="text" name="searchContent" placeholder="고객명" value="${searchContent }"> <input class="form-control" type="text" name="searchContent" placeholder="고객명" value="${searchContent }">
<div class="input-group-btn"> <div class="input-group-btn">
<input type="submit" class="btn btn-info btn-outline" value="검색"> <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> </div>
</div> </div>
@ -51,6 +51,7 @@ function validateTest(){
</div> </div>
<!-- row --> <!-- row -->
<input type="hidden" id="token"> <input type="hidden" id="token">
<a id="dlink" style="display:none;"></a>
<div class="table-responsive" id="table"> <div class="table-responsive" id="table">
<table class="table table-bordered table-hover table-striped"> <table class="table table-bordered table-hover table-striped">
<thead> <thead>