Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Auto Expand Html table when we paster data from Microsoft Excel sheet

843840Sep 20 2010
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 18 2010
Added on Sep 20 2010
0 comments
305 views