Results 1 to 7 of 7

Thread: Two questions: File I/O and Printing from ASP???

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    225

    Two questions: File I/O and Printing from ASP???

    Question 1:
    How do I read a file into an ASP variable so that I can output certain sections of it to a web page? (I am familiar with doing this in VB/VBS but not ASP)

    Question 2:
    When I create "Printable version" of a web page is it possible to insert page breaks so that the page will stop at the end of a paragraph and continue printing the next paragraph on another page. I can create the "Printer friendly version" just fine but I don't like the way it breaks up the content of the page when begins printing the next page (pg. 2, pg. 3, etc). In short, I would like to control where one page ends and the next begins.

    Thanks!

  2. #2
    Lively Member
    Join Date
    Mar 2001
    Location
    Sweden
    Posts
    115
    Answer 1:
    Code:
    Dim filesys, txtfile, line
    set filesys = Server.CreateObject("Scripting.FileSystemObject")
    set txtfile = filesys.OpenTextFile("c:\mytextfile.txt",1,0)
    Do
      line = txtfile.ReadLine
    Loop Until txtfile.AtEndOfStream
    txtfile.Close
    Answer 2:
    I have no idea...

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    225
    What is the 1,0 for?

    set txtfile = filesys.OpenTextFile("c:\mytextfile.txt",1,0)

    Thanks

  4. #4
    Lively Member
    Join Date
    Mar 2001
    Location
    Sweden
    Posts
    115
    1 = To read from the file (could also be 8... append to the file)

    0 = Open it as ASCII (could also be 1 (Unicode) or 2 (system standard)

  5. #5
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Q2. I believe controlling how a page will print has been added to CSS. Although it's probably currently supported with IE 5.5.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    225

    CSS???

    I have heard several people say that web developers should stay away from CSS (they actually mentioned another method to use but I can't remember it right now). What do you think about that, should I try to find an alternative or will CSS solve my problem (for all browsers). I currently use it to solve this same issue but I was hopeing for a different alternative.

    Thanks!

  7. #7
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    CSS is an official web standard. Browsers will eventually fully comply with it. I think it's the only way to format for printing, and it deliberately has the features added because there was a need for this.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width