Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5.1 > ASP.NET 4.5.1 General Discussion
|
ASP.NET 4.5.1 General Discussion For ASP.NET 4.5.1 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4.5.1 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2015, 02:29 AM
Registered User
 
Join Date: Sep 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default HTML form to be imported on Excel file on submitting

Hi,

I have written a code in HTMl and wanted the same to be saved in excel on submitting on HTMl form. Below is my code . please help.

Error: "On submitting just excel page is opening."


<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<SCRIPT LANGUAGE=JAVASCRIPT>
var currentDate = new Date();
var date1 = currentDate.getDate();
var mon = currentDate.getMonth()+1;
var year = currentDate.getYear();
var today = date1+"/"+mon+"/"+year;
var filePath = "C:\\Users\\18221\\Documents\\deskotp\\shashi.xlsx ";
function setDate()
{
f1.tDate.value=today;
}

function saveToExcel()
{
var myApp = new ActiveXObject("Excel.Application");
myApp.visible = false;
var xlCellTypeLastCell = 11;

var myWorksheet = myWorkbook.Worksheets(1);
myWorksheet.Activate;
objRange = myWorksheet.UsedRange;


objRange.SpecialCells(xlCellTypeLastCell).Activate ;
newRow = myApp.ActiveCell.Row + 1;
alert('newRow : '+newRow);
strNewCell = "A" + newRow;
alert('strNewCell : '+ strNewCell);
myApp.Range(strNewCell).Activate;
myWorksheet.Cells(newRow,7).value = f1.tRemark.value;
myWorkbook.Close(true);
myApp.Workbooks.Close;
myApp.Close;
alert('Data successfully saved');
}


</SCRIPT>
<BODY onLoad='setDate();'>
<form name="f1" method="post">
<h align="center"><b>Daily Report</b></h>

<table border="1" width="1000">
<tr>
<td width="250" height="25"></td>
<td width="200" class="tb_bor" align="center"><b>Date</b></td>
<td width="100" class="tb_bor" align="center"><b>Caller</b></td>
<td width="100" class="tb_bor" align="center"><b>Product</b></td>
<td width="150" class="tb_bor" align="center"><b>Nature Of Problem</b></b></td>
<td width="100" class="tb_bor" align="center"><b>Solutions</b></td>
<td width="100" class="tb_bor" align="center"><b>Status</b></td>
<td width="100" class="tb_bor" align="center"><b>Remark</b></td>
<td width="250"></td>
</tr>
<tr>
<td width="250" height="25"></td>
<td width="200" class="tb_bor" align="center"><input type=text name=tDate ></td>
<td width="100" class="tb_bor" align="center"><input type=text name="tCaller" ></td>
<td width="100" class="tb_bor" align="center"><input type=text name="tProduct" ></td>
<td width="150" class="tb_bor" align="center"><input type=text name="tNOP" ></td>
<td width="100" class="tb_bor" align="center"><input type=text name="tSolutions" ></td>
<td width="100" class="tb_bor" align="center"><input type=text name="tStatus" ></td>
<td width="100" class="tb_bor" align="center"><input type=text name="tRemark" ></td>
<td width="250"></td>
</tr>
</table>
<br>
<table align="center">
<input type="button" name="next" value="Next">
<input type="reset" name="clear" value="Clear">
<input type="button" name=save value="Save" onClick='saveToExcel();'>
</table>
</form>
</BODY>
</HTML>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot able to display images in converted HTML to Excel file gopiinamadar JSP Basics 0 September 15th, 2009 01:59 AM
Copy data from Excel to open HTML form Bartje Excel VBA 1 September 29th, 2006 04:02 AM
form submitting cro_crx Pro PHP 5 January 25th, 2005 12:19 PM
submitting a form have an input File alyeng2000 Classic ASP Basics 6 November 1st, 2003 09:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.