Auto Expand Html table when we paster data from Microsoft Excel sheet
hi,
I need copied data to my Html table.
Actual requirement is like that when i copy selected rows with selected columns from Microsoft excel sheet and press "ctlr v" on my jsp page then table on jsp must be auto expand as data in excel sheet.
Take an example.
I copy 4 rows with 3 columns from excel sheet.
I have JSP page with 1 row and 3 columns.
when i press "ctrl v" on first cell of my jsp table then table should be auto expand to accommodate 4 rows of excel sheet.
here i have some of the code which is near to this, this code just copy past only one row, but i need multiple rows.
If need then please refer below code and if possible then give me the solution to auto expand HTML table on JSP
Code to copy paste cell in to HTML Table
<form>
<table>
<tr>
<td><input type="text" name="t1_0" onchange="formatCells(this.value,'t1')"></td>
<td><input type="text" name="t1_1"></td>
<td><input type="text" name="t1_2"></td>
<td><input type="text" name="t1_3"></td>
<td><input type="text" name="t1_4"></td>
</tr>
<tr>
<td><input type="text" name="t2_0" onchange="formatCells(this.value,'t2')"></td>
<td><input type="text" name="t2_1"></td>
<td><input type="text" name="t2_2"></td>
<td><input type="text" name="t2_3"></td>
<td><input type="text" name="t2_4"></td>
</tr>
</table>
</form>
<script type="text/javascript">
function formatCells(xls,group){
var arrGroup = xls.split(/\t/gi);
for(var i=0;i<arrGroup.length;i++){
document.forms[0].elements[group + "_" + i].value = arrGroup;
}
}
</script>
Thanks
Chintan Patel