delphi programming forums mysql charset mget recursive synonimos
free ventrilo servers hosting cs javascript delay python find in list
Back Forum New
abstract:

Also, would it be possible to run this from a stand alone machine so that the web form, .ASP and spreadsheet are all contained on the machine and have no outside influences?
I am new to using .ASP and server side processing so basic steps and terminology would be appreciated!!!
Cheers


I want 2 create a survey
Web Form
that people can fill in. I then want the data entered to be saved to an
Excel
spreadsheet located on a server.
Can .ASP handle this kind of task? and if so does anyone know the code required to perform this function?
The data entered will be RAW and the .ASP (or whatever required programming) will need 2 process and convert the data into the spreadsheet.
Also, would it be possible to run this from a stand alone machine so that the web form, .ASP and spreadsheet are all contained on the machine and have no outside influences?
I am new to using .ASP and server side processing so basic steps and terminology would be appreciated!!!
Cheers

TOP

I know no-one has yet replied to my post but I have been investigating myself since the post and I have a very simple question.
If I am inputting into my code <form action="formhandler.asp"> does the document I am putting the code in have to be called formhandler.asp or does it have to be saved as an HTML file and a seperate .ASP file be created?
Suppose what I am trying to say is do I need one file with an .ASP extension with all HTML and ASP coding within it or one for the HTML and one for the .ASP???
Also. is there an easy way to test if the pages are working without posting to a website? I am using Windows XP Professional if that is any help!!!
Cheers

TOP

You only need one page: formhandler.asp
if you're really clever, you can put the form on the same page as the formhandler, and post the form to itself.
Now, automating Excel. Here is an example using JScript, you could probably convert it to ASP (cos it seems to be the same syntax):
Code:
  1. <SCRIPT LANGUAGE="JScript">
  2. function AutomateExcel()
  3. {
  4.         // Start Excel and get Application object.
  5.         var oXL = new ActiveXObject("Excel.Application");
  6.         oXL.Visible = true;
  7.         // Get a new workbook.
  8.         var oWB = oXL.Workbooks.Add();
  9.         var oSheet = oWB.ActiveSheet;
  10.         // Add table headers going cell by cell.
  11.         oSheet.Cells(1, 1).Value = "Scientist";
  12.         oSheet.Cells(1, 2).Value = "<% response.write(name) %>";
  13.         oSheet.Cells(2, 1).Value = "Month Beginning";
  14.         oSheet.Cells(2, 2).Value = "<% response.write(monthago + 1) %>";
  15.         oSheet.Range("A1", "A2").Font.Bold = true;
  16.         oSheet.Cells(4, 1).Value = "Date";
  17.         oSheet.Cells(4, 2).Value = "Start";
  18.         oSheet.Cells(4, 3).Value = "End";
  19.         oSheet.Cells(4, 5).Value = "Time Spent";
  20.         oSheet.Range("A4", "E4").Font.Bold = true;
  21.         <%
  22.         row = 5
  23.         while not rs2.eof
  24.                 thisend = datediff("d",end_time, rs2("day_date"))
  25.                 thisstart = datediff("d",start_time,rs2("day_date"))
  26.                 if thisstart > -1 and thisend < 1 then
  27.                         if rs2("time_start") <> "" and rs2("time_end") <> "" then
  28.                                 daystart = FormatDateTime(hour(rs2("time_start")) & ":" & minute(rs2("time_start")),4)
  29.                                 dayend = FormatDateTime(hour(rs2("time_end")) & ":" & minute(rs2("time_end")),4)
  30.                                 mins = datediff("n",daystart,dayend)
  31.                                 mins = mins - minute(formatdatetime(rs2("lunch"),vbshorttime)) - hour(formatdatetime(rs2("lunch"),vbshorttime)) * 60
  32.                         end if
  33.                         hrs = Cint(mins / 60)
  34.                         if hrs > mins / 60 then hrs = hrs - 1
  35.                         mins = mins mod 60
  36.                         if mins < 10 then mins = "0" & mins
  37.                         response.write("oSheet.Cells(" & row & ", 1).Value = '" & rs2("day_date") & "'" & vbcrlf)
  38.                         response.write("oSheet.Cells(" & row & ", 2).Value = '" & rs2("time_start") & "'" & vbcrlf)
  39.                         response.write("oSheet.Cells(" & row & ", 3).Value = '" & rs2("time_end") & "'" & vbcrlf)
  40.                         response.write("oSheet.Cells(" & row & ", 4).Value = '" & formatdatetime(rs2("lunch"),vbshorttime) & "'" & vbcrlf)
  41.                         response.write("oSheet.Cells(" & row & ", 5).Value = '" & formatdatetime(hrs & ":" & mins,vbshorttime) & "'" & vbcrlf)
  42.                         row = row + 1
  43.                 end if
  44.                 rs2.movenext
  45.         wend
  46.         row = row + 1
  47.         if not rs4.eof then
  48.         %>
  49.         oSheet.Cells(<%response.write(row) %>, 1).Value = "Date";
  50.         oSheet.Cells(<%response.write(row) %>, 2).Value = "Task Name";
  51.         oSheet.Cells(<%response.write(row) %>, 3).Value = "Customer";
  52.         oSheet.Cells(<%response.write(row) %>, 4).Value = "Status";
  53.         oSheet.Cells(<%response.write(row) %>, 5).Value = "Product";
  54.         oSheet.Cells(<%response.write(row) %>, 6).Value = "Project";
  55.         oSheet.Cells(<%response.write(row) %>, 7).Value = "Time Spent";
  56.         oSheet.Range("A<%response.write(row) %>", "G<%response.write(row) %>").Font.Bold = true;
  57.         <%
  58.         row = row + 1
  59.         while not rs4.eof
  60.                 thisend = datediff("d",end_time, rs4("day_date"))
  61.                 thisstart = datediff("d",start_time,rs4("day_date"))
  62.                 if thisstart > -1 and thisend < 1 then
  63.                         response.write("oSheet.Cells(" & row & ", 1).Value = '" & rs4("day_date") & "'" & vbcrlf)
  64.                         response.write("oSheet.Cells(" & row & ", 2).Value = '" & rs4("task_type") & "'" & vbcrlf)
  65.                         response.write("oSheet.Cells(" & row & ", 3).Value = '" & rs4("customer") & "'" & vbcrlf)
  66.                         response.write("oSheet.Cells(" & row & ", 4).Value = '" & rs4("status") & "'" & vbcrlf)
  67.                         response.write("oSheet.Cells(" & row & ", 5).Value = '" & rs4("product") & "'" & vbcrlf)
  68.                         response.write("oSheet.Cells(" & row & ", 6).Value = '" & rs4("project") & "'" & vbcrlf)
  69.                         response.write("oSheet.Cells(" & row & ", 7).Value = '" & rs4("used") & "'" & vbcrlf)
  70.                         row = row + 1
  71.                 end if
  72.                 rs4.movenext
  73.         wend
  74.         rs4.movefirst
  75.         end if
  76.         row = row + 1
  77.         %>
  78.         oSheet.Cells(<%response.write(row) %>, 1).Value = "Product";
  79.         oSheet.Cells(<%response.write(row) %>, 2).Value = "Time Spent";
  80.         oSheet.Range("A<%response.write(row) %>", "B<%response.write(row) %>").Font.Bold = true;
  81.         <%
  82.         row = row + 1
  83.         for x = 0 to ubound(analysAry) - 1
  84.                 if not analysAry(x, 0) = "" then
  85.                         hr = Cint(analysAry(x, 1) / 60)
  86.                         if hr > analysAry(x, 1) / 60 then hr = hr - 1
  87.                         min = analysAry(x, 1) mod 60
  88.                         response.write("oSheet.Cells(" & row & ", 1).Value = '" & analysAry(x, 0) & "'" & vbcrlf)
  89.                         response.write("oSheet.Cells(" & row & ", 2).Value = '" & hr & ":" & min & "'" & vbcrlf)
  90.                         row = row + 1
  91.                 end if
  92.         next
  93.         response.write("oRng = oSheet.Range(""A1"", ""H" & row & """);")
  94.         %>
  95.         oRng.EntireColumn.AutoFit();
  96. }
  97. </SCRIPT>
Copy Code
Also, you can run code locally by setting up IIS on your own machine, and putting ASP pages in the inetpub/wwwroot directory.

TOP

Thanxz 4 the help. It does seem 2 be getting further than my previous attempts but still no Excel file is being generated. Which part of the code denotes the location of where the Excel file is saved to?
Also, Internet Explorer says there is an error in the syntax of the code. Any ideas where this error may b located in the code given above?
Cheers

TOP

abstract:

Also, would it be possible to run this from a stand alone machine so that the web form, .ASP and spreadsheet are all contained on the machine and have no outside influences?
I am new to using .ASP and server side processing so basic steps and terminology would be appreciated!!!
Cheers


I have done some more investigating on the Intranet capabilities of the site I am meant to be hosting the survey on and it now appears they do not support ASP. Can what I am attempting to achieve be completed using any of the following standards and if so where are the best places to find information out about this?
PERL
JSP
Cold Fusion
CGI
Any help much appreciated as always as time is now against me :-)

TOP

The code is jscript, but should have transferred to ASP.
This shows how Excel files can be created from PHP:
http://www.stargeek.com/scripts.php?script=2&cat=sql
the include bit at the start is linking to a file with the connection to a mysql database, you may have to look around for a few hints on changing this, though
http://php.net
can help a lot, great manual.
Good luck!



Also, would it be possible to run this from a stand alone machine so that the web form, .ASP and spreadsheet are all contained on the machine and have no outside influences?
I am new to using .ASP and server side processing so basic steps and terminology would be appreciated!!!
Cheers

TOP

Back Forum