Export to Excel function is not working, its not coming anything when i clicked the button, pls help me
<script>
function ExportToExcel(type, fn, dl)
{
var elt = document.getElementById('table');
var wb = XLSX.utils.table_to_book(elt, { sheet: "sheet1" });
return dl ?
XLSX.write(wb, { bookType: type, bookSST: true, type: 'base64' }) :
XLSX.writeFile(wb, fn || ('Report generated.' + (type || 'xlsx')));
}
</script>
<div class="w3-row-padding" >
<p class="w3-center">
<input class="w3-button w3-theme-d5 w3-center w3-round-xlarge w3-hover-light-blue" type="Submit" name="export" value="Export to Excel" class="button" onClick="ExportToExcel('xlsx')">
</p>
</div>
Yes sir. I am very new to java script, if you give the code what i have change means it is most useful to understand sir.
This is my full code, I can’t able to jump to next page onclick the dashboard button and can’t able to excel export . pls correct the code if i click the button nothing was happening here sir.
SUHAM Programme - CHNP MIS
.full-height {
height: 100%;
}
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="./css/w3.css">
<link rel="stylesheet" href="./css/w3-theme-blue.css">
<style>
hr.solid {
border-top: 15px solid #fff;
background-color:#0b78d1
}
</style>
<%@page import = “java.sql.DriverManager,java.sql.Connection,java.sql.Statement,java.sql.ResultSet,java.sql.SQLException, java.util.Vector” %>
<%
Statement stmt = null;
Connection con = null;
ResultSet rsT = null;
boolean errFlag = false;
String str = null;
%>
<a class="w3-bar-item w3-button" href="rept1.jsp">CHNP Dashboard</a>
<a class="w3-bar-item w3-button" href="rept2.jsp">WASH Dashboard</a>
<a class="w3-bar-item w3-button" href="rept3.jsp">MCD Dashboard</a>
<a class="w3-bar-item w3-button" href="rept4.jsp">COVID-19</a>
<a class="w3-bar-item w3-button" href="Login.jsp">Log out</a>
<button class="w3-bar-item w3-button w3-xlarge w3-theme-d4" onclick="openSidebar()">☰</button>
<h3>CHNP MIS Reports Section</h3>
</header>
<div class="w3-cell-row">
<div class=" w3-cell w3-center w3-theme-d2" >
<label> Reports - CHNP MIS </label>
</div>
</div>
<%
stmt = (Statement) session.getValue("STMT");
if(stmt == null)
{
%> <center><h2><font color=red>Session time out error, Press 'F5' to refresh</h2></center> <%
return;
}
%>
<div class="w3-row-padding" >
<p class="w3-center">
<input class="w3-button w3-theme-d5 w3-center w3-round-xlarge w3-hover-light-blue" type="Submit" name="export" value="Export to Excel" class="button" onClick="ExportToExcel('xlsx')">
<input type="Submit" name="dashboard" value="View Dashboard" class="w3-button w3-theme-d5 w3-center w3-round-xlarge w3-hover-light-blue" onClick="clicks()">
</p>
</div>
<div class="w3-row-padding" class="w3-center" style="border:1px solid black;width:auto;height:80%;overflow:scroll;">
<form name="report" id="report" >
<table id="report" name="table1" align="center" cellpadding="4" cellspacing="4">
<%
<td><center><%=intrepaid20%></center></td>
<td><center><%=intrepaid21%></center></td>
<td><center><%=intrepaid22%></center></td>
<td><center><%=memcode%></center></td>
</tr>
<%
}
rsT.close();
%>
</table>
</form> </div>
<%
stmt = null;
con = null;
rsT = null;
}
catch(SQLException sqle)
{
str = "<h2>Error : " + sqle + "</h2>";
errFlag = true;
}
%>