ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old May 10th, 2003, 12:22 PM
MGarde MGarde is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 7 MGarde User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Creating An Excel Spreadsheet From Web Form Data

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

Reply With Quote
  #2  
Old May 11th, 2003, 01:02 PM
MGarde MGarde is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 7 MGarde User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #3  
Old May 12th, 2003, 09:12 PM
binky's Avatar
binky binky is offline
Gerbil
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Oct 2001
Location: In a Rotastak
Posts: 1,763 binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 22 h 12 m 52 sec
Reputation Power: 18
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:
<SCRIPT LANGUAGE="JScript"> 
function AutomateExcel()
{

	// Start Excel and get Application object.
	var oXL = new ActiveXObject("Excel.Application");
       
	oXL.Visible = true;
      
	// Get a new workbook.
	var oWB = oXL.Workbooks.Add();
	var oSheet = oWB.ActiveSheet;
         
	// Add table headers going cell by cell.
	oSheet.Cells(1, 1).Value = "Scientist";
	oSheet.Cells(1, 2).Value = "<% response.write(name) %>";
	oSheet.Cells(2, 1).Value = "Month Beginning";
	oSheet.Cells(2, 2).Value = "<% response.write(monthago + 1) %>";
	oSheet.Range("A1", "A2").Font.Bold = true;

	oSheet.Cells(4, 1).Value = "Date";
	oSheet.Cells(4, 2).Value = "Start";
	oSheet.Cells(4, 3).Value = "End";
	oSheet.Cells(4, 5).Value = "Time Spent";
	oSheet.Range("A4", "E4").Font.Bold = true;

	<%
	row = 5
	while not rs2.eof
		thisend = datediff("d",end_time, rs2("day_date"))
		thisstart = datediff("d",start_time,rs2("day_date"))
		if thisstart > -1 and thisend < 1 then 
			if rs2("time_start") <> "" and rs2("time_end") <> "" then
				daystart = FormatDateTime(hour(rs2("time_start")) & ":" & minute(rs2("time_start")),4)
				dayend = FormatDateTime(hour(rs2("time_end")) & ":" & minute(rs2("time_end")),4)
				mins = datediff("n",daystart,dayend)
				mins = mins - minute(formatdatetime(rs2("lunch"),vbshorttime)) - hour(formatdatetime(rs2("lunch"),vbshorttime)) * 60
			end if
			hrs = Cint(mins / 60)
			if hrs > mins / 60 then hrs = hrs - 1
			mins = mins mod 60
			if mins < 10 then mins = "0" & mins
			response.write("oSheet.Cells(" & row & ", 1).Value = '" & rs2("day_date") & "'" & vbcrlf)
			response.write("oSheet.Cells(" & row & ", 2).Value = '" & rs2("time_start") & "'" & vbcrlf)
			response.write("oSheet.Cells(" & row & ", 3).Value = '" & rs2("time_end") & "'" & vbcrlf)
			response.write("oSheet.Cells(" & row & ", 4).Value = '" & formatdatetime(rs2("lunch"),vbshorttime) & "'" & vbcrlf)
			response.write("oSheet.Cells(" & row & ", 5).Value = '" & formatdatetime(hrs & ":" & mins,vbshorttime) & "'" & vbcrlf)
			row = row + 1
		end if
		rs2.movenext
	wend
	row = row + 1

	if not rs4.eof then
	%>
	oSheet.Cells(<%response.write(row) %>, 1).Value = "Date";
	oSheet.Cells(<%response.write(row) %>, 2).Value = "Task Name";
	oSheet.Cells(<%response.write(row) %>, 3).Value = "Customer";
	oSheet.Cells(<%response.write(row) %>, 4).Value = "Status";
	oSheet.Cells(<%response.write(row) %>, 5).Value = "Product";
	oSheet.Cells(<%response.write(row) %>, 6).Value = "Project";
	oSheet.Cells(<%response.write(row) %>, 7).Value = "Time Spent";
	oSheet.Range("A<%response.write(row) %>", "G<%response.write(row) %>").Font.Bold = true;
	<%
	row = row + 1
	while not rs4.eof
		thisend = datediff("d",end_time, rs4("day_date"))
		thisstart = datediff("d",start_time,rs4("day_date"))
		if thisstart > -1 and thisend < 1 then 
			response.write("oSheet.Cells(" & row & ", 1).Value = '" & rs4("day_date") & "'" & vbcrlf)
			response.write("oSheet.Cells(" & row & ", 2).Value = '" & rs4("task_type") & "'" & vbcrlf)
			response.write("oSheet.Cells(" & row & ", 3).Value = '" & rs4("customer") & "'" & vbcrlf)
			response.write("oSheet.Cells(" & row & ", 4).Value = '" & rs4("status") & "'" & vbcrlf)
			response.write("oSheet.Cells(" & row & ", 5).Value = '" & rs4("product") & "'" & vbcrlf)
			response.write("oSheet.Cells(" & row & ", 6).Value = '" & rs4("project") & "'" & vbcrlf)
			response.write("oSheet.Cells(" & row & ", 7).Value = '" & rs4("used") & "'" & vbcrlf)
			row = row + 1
		end if
		rs4.movenext
	wend
	rs4.movefirst
	end if
	row = row + 1
	%>
	oSheet.Cells(<%response.write(row) %>, 1).Value = "Product";
	oSheet.Cells(<%response.write(row) %>, 2).Value = "Time Spent";
	oSheet.Range("A<%response.write(row) %>", "B<%response.write(row) %>").Font.Bold = true;
	<%
	row = row + 1
	for x = 0 to ubound(analysAry) - 1
		if not analysAry(x, 0) = "" then
			hr = Cint(analysAry(x, 1) / 60)
			if hr > analysAry(x, 1) / 60 then hr = hr - 1
			min = analysAry(x, 1) mod 60
			response.write("oSheet.Cells(" & row & ", 1).Value = '" & analysAry(x, 0) & "'" & vbcrlf)
			response.write("oSheet.Cells(" & row & ", 2).Value = '" & hr & ":" & min & "'" & vbcrlf)
			row = row + 1
		end if
	next
	response.write("oRng = oSheet.Range(""A1"", ""H" & row & """);")
	%>
	oRng.EntireColumn.AutoFit();
         
}
</SCRIPT>


Also, you can run code locally by setting up IIS on your own machine, and putting ASP pages in the inetpub/wwwroot directory.
__________________
- Sorted!

www.ppfuk.com - Free Photo Sharing

Reply With Quote
  #4  
Old May 13th, 2003, 12:25 PM
MGarde MGarde is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 7 MGarde User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #5  
Old May 16th, 2003, 03:08 AM
MGarde MGarde is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 7 MGarde User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation

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 :-)

Reply With Quote
  #6  
Old May 19th, 2003, 09:22 PM
binky's Avatar
binky binky is offline
Gerbil
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Oct 2001
Location: In a Rotastak
Posts: 1,763 binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 22 h 12 m 52 sec
Reputation Power: 18
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!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Creating An Excel Spreadsheet From Web Form Data


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway