Printing web pages

Discussion in 'HTML' started by scorpion53061, Sep 1, 2003.

  1. Hi I am actually a vb.net windows developer using code to write a web page.
    I have a loop that writes rows to the web page. What I would like to do is:

    1. Every five tables force a page break

    OR

    2. If a table is broken between pages it should force a pagebreak to make
    the table appear on the next page.

    Can this be done in HTML? thank you for any help.........

    A sample of how it is looking in my project....drs is a variable for row ,
    Dshistory1.Tables is the table of data to be written, i is the integer
    indicating what row you are on, sw is the data.

    For Each drs In Dshistory1.Tables(0).Rows

    i = i + 1

    sw.WriteLine("<html>")

    sw.WriteLine("<body>")

    sw.WriteLine("<table border=3 cellspacing=1 width=100% id=AutoNumber1>")

    sw.WriteLine("<tr>")

    sw.WriteLine("<td width=33% align=center><b>CUSTNO</b></td>")

    sw.WriteLine("<td width=33% align=center><b>CUSTNAME</b></td>")

    sw.WriteLine("<td width=34% align=center><b>SLSMNO</b></td>")

    sw.WriteLine("</tr>")

    sw.WriteLine("<tr>")

    sw.WriteLine("<td width=33% align=center>" &
    Dshistory1.Tables(0).Rows(i).Item("CUSTNO") & "</td>")

    sw.WriteLine("<td width=33% align=center>" &
    Dshistory1.Tables(0).Rows(i).Item("CUSTNAME") & "</td>")

    sw.WriteLine("<td width=34% align=center>" &
    Dshistory1.Tables(0).Rows(i).Item("SLSMN") & "</td>")

    sw.WriteLine("</tr>")

    sw.WriteLine("</table>")

    sw.WriteLine("</center>")

    sw.WriteLine("</div>")

    Next

    sw.WriteLine("</body>")

    sw.WriteLine("</html>")

    sw.Close()
     
    scorpion53061, Sep 1, 2003
    #1
    1. Advertising

  2. scorpion53061 wrote:

    > 2. If a table is broken between pages it should force a pagebreak to make
    > the table appear on the next page.


    Look into the CSS 2 paged media stuff:

    http://www.w3.org/TR/CSS2/page.html

    You could use, say:

    table
    {
    page-break-inside: avoid;
    }

    to ask the browser not to break pages within the table (sometimes a page
    break is unavoidable though, for instance, if the table is more that one
    page long)

    Be aware though that not all browsers are smart enough to handle CSS
    pages.

    --
    Toby A Inkster BSc (Hons) ARCS | mailto: | pgp:0x6A2A7D39
    aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:
    http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
    playing://(nothing)
     
    Toby A Inkster, Sep 1, 2003
    #2
    1. Advertising

  3. scorpion53061

    webgeo99 Guest

    "scorpion53061" <> wrote in message
    news:...
    > Hi I am actually a vb.net windows developer using code to write a web

    page.
    > I have a loop that writes rows to the web page. What I would like to do

    is:
    >
    > 1. Every five tables force a page break
    >
    > OR
    >
    > 2. If a table is broken between pages it should force a pagebreak to make
    > the table appear on the next page.
    >
    > Can this be done in HTML? thank you for any help.........
    >
    > A sample of how it is looking in my project....drs is a variable for row ,
    > Dshistory1.Tables is the table of data to be written, i is the integer
    > indicating what row you are on, sw is the data.
    >
    > For Each drs In Dshistory1.Tables(0).Rows
    >
    > i = i + 1
    >
    > sw.WriteLine("<html>")
    >
    > sw.WriteLine("<body>")
    >
    > sw.WriteLine("<table border=3 cellspacing=1 width=100% id=AutoNumber1>")
    >
    > sw.WriteLine("<tr>")
    >
    > sw.WriteLine("<td width=33% align=center><b>CUSTNO</b></td>")
    >
    > sw.WriteLine("<td width=33% align=center><b>CUSTNAME</b></td>")
    >
    > sw.WriteLine("<td width=34% align=center><b>SLSMNO</b></td>")
    >
    > sw.WriteLine("</tr>")
    >
    > sw.WriteLine("<tr>")
    >
    > sw.WriteLine("<td width=33% align=center>" &
    > Dshistory1.Tables(0).Rows(i).Item("CUSTNO") & "</td>")
    >
    > sw.WriteLine("<td width=33% align=center>" &
    > Dshistory1.Tables(0).Rows(i).Item("CUSTNAME") & "</td>")
    >
    > sw.WriteLine("<td width=34% align=center>" &
    > Dshistory1.Tables(0).Rows(i).Item("SLSMN") & "</td>")
    >
    > sw.WriteLine("</tr>")
    >
    > sw.WriteLine("</table>")
    >
    > sw.WriteLine("</center>")
    >
    > sw.WriteLine("</div>")
    >
    > Next
    >
    > sw.WriteLine("</body>")
    >
    > sw.WriteLine("</html>")
    >
    > sw.Close()


    First off, how many rows do you want in a table? How many tables before the
    break.
    Also (sw) is NOT the data beign written. The value of ITEM is what you are
    writing to the table. You also have the value of Tables set to (0) meaning
    it will ALWAYS be (0). You can remove the (sw) and change the value of
    Tables to a variable that will change when the row limit has been reached by
    checking to see how many rows have been written.
     
    webgeo99, Nov 3, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    424
    Hans Kesting
    Nov 4, 2003
  2. Jon B
    Replies:
    7
    Views:
    7,510
    =?Utf-8?B?SmFzb25DaG9p?=
    Jan 30, 2006
  3. Nathan Sokalski
    Replies:
    5
    Views:
    1,023
    Gaurav Vaish \(www.Edujini-Labs.com\)
    Jan 10, 2007
  4. Nathan Sokalski
    Replies:
    4
    Views:
    299
    Nathan Sokalski
    Dec 21, 2006
  5. Nathan Sokalski
    Replies:
    4
    Views:
    337
    Nathan Sokalski
    Dec 21, 2006
Loading...

Share This Page