Hi,
Ok, last question of the day!
Can I have the contents of a *.txt file simply being printed on a page
(presumably by using response.write)?
Many thanks for all your help today,
Oli 9 2435
Not ~printed~ since that would be something the user would have to do, but
if you mean displayed in the page, you can <!-- #include
file="yourfile.txt" --> it or Server.Execute "file.txt" it.
Those are two options.
Ray at work
"Oli" <ol*@NOSPAMoliwoods.co.uk> wrote in message
news:bq**********@sparta.btinternet.com... Hi,
Ok, last question of the day!
Can I have the contents of a *.txt file simply being printed on a page (presumably by using response.write)?
Many thanks for all your help today, Oli
Also, you could use Scripting.FileSystemObject to open the file and read it
(e.g. if you wanted to parse the contents, or only show certain lines, etc.)
--
Aaron Bertrand
SQL Server MVP http://www.aspfaq.com/
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:#p**************@TK2MSFTNGP12.phx.gbl... Not ~printed~ since that would be something the user would have to do, but if you mean displayed in the page, you can <!-- #include file="yourfile.txt" --> it or Server.Execute "file.txt" it.
Those are two options.
Ray at work
"Oli" <ol*@NOSPAMoliwoods.co.uk> wrote in message news:bq**********@sparta.btinternet.com... Hi,
Ok, last question of the day!
Can I have the contents of a *.txt file simply being printed on a page (presumably by using response.write)?
Many thanks for all your help today, Oli
Hi,
You can do this...
Set myObject = Server.CreateObject("Scripting.FileSystemObject")
Set myTextFile = myObject.OpenTextFile(Server.MapPath("../../textfile.txt"))
While not myTextFile.AtEndOfStream
Response.Write(myTextFile.ReadLine & "<br>")
Wend
myTextFile.Close
Regards,
Bhaskardeep Khaund
> While not myTextFile.AtEndOfStream Response.Write(myTextFile.ReadLine & "<br>")
Ugh... a loop? Why? How about :
Response.Write Replace(myTextFile.ReadAll(), vbCrLf, "<br>")
--
Aaron Bertrand
SQL Server MVP http://www.aspfaq.com/
Wend
myTextFile.Close
Regards,
Bhaskardeep Khaund
Why go line by line? Just readall and replace vbCrLfs with <br>s or use the
<pre> tag.
Ray at work
"Bhaskardeep Khaund" in an HTML message:
You can do this...
Set myObject = Server.CreateObject("Scripting.FileSystemObject")
Set myTextFile = myObject.OpenTextFile(Server.MapPath("../../textfile.txt"))
While not myTextFile.AtEndOfStream
Response.Write(myTextFile.ReadLine & "<br>")
Wend
myTextFile.Close
Regards,
Bhaskardeep Khaund
Hi,
I have used the loot because, if the content of the text file is too big it would be an extra strain on the server. And when using the loops u could format each sentence, leading to more flexibility. I think its a matter of coding style. Whats say?
Bhaskardeep Khaund
Please post in plain text. These HTML attachments are annoying, and so is
having to switch from HTML mode when replying. I think we just found #5007!
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:uY**************@TK2MSFTNGP10.phx.gbl... Please post in plain text. I think we just found #5007!
DO IT!
Aaron Bertrand [MVP] wrote: Please post in plain text. These HTML attachments are annoying, and so is having to switch from HTML mode when replying. I think we just found #5007!
LOL - good call.
--
William Tasso - http://WilliamTasso.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Manfred Schwab |
last post by:
Recording messages and print statements in a textfile during program
execution.
Is there a similar command to redirect errormessages or print statements
into a standart asciifile during...
|
by: hamil |
last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview
control, the PageSetup control, and the Print dialog control. The code
attached is a concatination of two examples taken out...
|
by: Ron |
last post by:
Hi All,
Is it possible to have Access print a report, identical to one that would
print to a printer, only print to a "standard" text file? I can't find it
in help and when I try to just print...
|
by: Max58kl |
last post by:
Trying to access data and print it to the screen using Perl Builders I/O Window
--------------------------------------------------------------------------------
Hi
I am using a program called...
|
by: itdaddy |
last post by:
hey perl gurus!
i am new to this forum cause i need help. I have done many scripts.
but i want to use perl to do this:
What I want to do is this. I have a QRP file that I can convert to a txt...
|
by: alivip |
last post by:
when I wont to inser (anyting I print) to the textbox it will not inser
it just print then hanging
# a look at the Tkinter Text widget
# use ctrl+c to copy, ctrl+x to cut selected text,
#...
|
by: Studiotyphoon |
last post by:
Hi,
I have report which I need to print 3 times, but would like to have
the following headings
Customer Copy - Print 1
Accounts Copy - Print 2
File Copy -Print 3
I created a macro to...
|
by: prakashturkar |
last post by:
Hi,
I am Prakash....
I have tried to print an MS Word file using the basic print utilities provided in JAVA.But while asking for printing through my own code i am getting proble for example..."The...
|
by: dmorand |
last post by:
When I try to print a 'print version' of my page it looks fine in IE 7, but when I print in IE 6 the margins are all screwed up. The page itself looks the same in both browsers, it's just when I...
|
by: JWest46088 |
last post by:
I'm having difficulty trying to figure out how to print a text file from a hash table one line at a time. I have the text file read into the hash table and can print the text file all at once, but I...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |