Need to format text output from print.asp

J

Jeremy

The ASP script below, grabs marked text from a web page and prints it for
printer friendly pages. I would like to be able to format the text output.

The statement that puts out the text is
response.write text

I have tried various ways of formating this statement and nothing works. How
can I get my printer friendly text into a formated table please?

Many thanks for your help! Jeremy
======================================================================================================================
<%
Dim page, text, filesys
page = request.querystring("page")

Sub ReplaceTxt(what,door)

Dim regularExpressionObject
Set RegularExpressionObject = New RegExp

With RegularExpressionObject
.Pattern = what
.IgnoreCase = True
.Global = True
End With

text = RegularExpressionObject.Replace(text,door)
Set RegularExpressionObject = nothing
End Sub

'opening the page
Set FileSys = server.createobject("scripting.FileSystemObject")
text = filesys.openTextfile(server.mappath(page)).readall
call replacetxt("<!-- noprint -->","<!--")
call replacetxt("<!-- /noprint -->"," -->")

'writing the text-only version
response.write "<font size='2' face='arial'><b>Printer Friendly Version
of <i><a href='javascript:history.go(-1)'>"&page&"</a></i></b></font><br><hr
noshade color='#000000' size='1'>"
response.write text

response.write "<p align='center'><font size='1'
face='verdana'>Copyright (C) 2002 Pete Yagmin<br>This page was printed from
Your Website at http://www.yourwebaddress.com</font></p>"
%>
===================================================================================================================
 
S

Stefan B Rusynko

You can't w/ your routine since you are calling the page content into a plain text file as a TextStream object w/
text = filesys.openTextfile(server.mappath(page)).readall
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| The ASP script below, grabs marked text from a web page and prints it for
| printer friendly pages. I would like to be able to format the text output.
|
| The statement that puts out the text is
| response.write text
|
| I have tried various ways of formating this statement and nothing works. How
| can I get my printer friendly text into a formated table please?
|
| Many thanks for your help! Jeremy
| ======================================================================================================================
| <%
| Dim page, text, filesys
| page = request.querystring("page")
|
| Sub ReplaceTxt(what,door)
|
| Dim regularExpressionObject
| Set RegularExpressionObject = New RegExp
|
| With RegularExpressionObject
| .Pattern = what
| .IgnoreCase = True
| .Global = True
| End With
|
| text = RegularExpressionObject.Replace(text,door)
| Set RegularExpressionObject = nothing
| End Sub
|
| 'opening the page
| Set FileSys = server.createobject("scripting.FileSystemObject")
| text = filesys.openTextfile(server.mappath(page)).readall
| call replacetxt("<!-- noprint -->","<!--")
| call replacetxt("<!-- /noprint -->"," -->")
|
| 'writing the text-only version
| response.write "<font size='2' face='arial'><b>Printer Friendly Version
| of <i><a href='javascript:history.go(-1)'>"&page&"</a></i></b></font><br><hr
| noshade color='#000000' size='1'>"
| response.write text
|
| response.write "<p align='center'><font size='1'
| face='verdana'>Copyright (C) 2002 Pete Yagmin<br>This page was printed from
| Your Website at http://www.yourwebaddress.com</font></p>"
| %>
| ===================================================================================================================
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top