Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting asp to word document

Status
Not open for further replies.

chinedu

Technical User
Mar 7, 2002
241
US
Hello good people,
I am trying to convert an asp page to a word document.
When I "manually" type in the names just like I want them to look like in a word document, it works.
By manually, I mean, I create page1 with form variables.
Then I pass those form variables to page2 using request.querystring.
Everything works fine, asp gets converted to word document.

However, I am trying to eliminate page1 entirely and just use one page.
This way, the fields I want to see in a word document are
pulled directly from the database.
When I try this, I get the following error:
"Internet explorer was unable to open the following site. The requested site is either unavailable or cannot be found"

I am posting the 2 pages.
I would have posted only one page but I wanted to you give a clearer picture of what I am trying to do.
Any help would be greatly appreciated.
Thanks in advance
Note: I may have trouble posting this code in a formatted manner.

Code:
'*********** page1 *******************
<html>
<head><title>Create a word document</title></head>
<body>
<center>
<font color="#800080" size="4"><b>
Create a word document</b></font>
</center>
<p>
<center>
</p>
<table>
<form action="word_create.asp">
<tr>
<td><font color="#000080" size="3"><b>Name:</b></font> </td>
<td><input type="text" name="Name" size="50" maxlength="100"></td>
</tr>
<tr>
<td><font color="#000080" size="3"><b>Email:</b></font> </td>
<td><input type="text" name="Email" size="50" maxlength="100"></td>
</tr>
<tr><td>
<font color="#000080" size="3"><b>
Comments:</b></font> </td><td>
<textarea cols="50" rows="10" name="comments"></textarea></td>
</tr>
</table>
</center>
<p align="center">
<input type="submit" value="Submit">
</form><p align="left">&nbsp;</p>
</body>
</html>

'*********** page2***************************

<%
  Response.ContentType = "application/msword"
  Response.AddHeader "Content-Disposition","attachment;filename=epd.doc"
 %>
<html>
<head>
<title>Word creation</title>
</head>
<body bgcolor="#FFFFFF">
<table>
<tr>
<td><b>Depart of Public Works</b></td><td><table><tr><td><img src="images/fclogo.jpg"></td></tr></table></td>
</tr>
<tr>
<td>141 Pryor Street, S.W., Suite 6001</td>
</tr>
<tr>
<td>Atlanta, GA 30303</td>
</tr>
<tr>
<td>Telephone:(404) 730-7400</td>
</tr>
<tr>
<td>Fax:(404) 224-0978</td>
</tr>
</table>
<%
Set myConn=Server.CreateObject("ADODB.Connection")
myConn.open("Spills")
strName = Request.Querystring("Name")
strEmail = Request.Querystring("Email")
strComments = Request.Querystring("Comments")
sql="select * from sTableView "
set rs = myConn.Execute(sql)
%> <p align="right"><%=formatdatetime(now,2)%></p>Dear <%= strname %>: <br>

My email addess is: <%= stremail %> <br>
My Comments are: <%= strComments %>
<table><tr><td><%=rs("date_found")%></td></tr></table>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top