Printing web pages

  • Thread starter Thread starter scorpion53061
  • Start date Start date
S

scorpion53061

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()
 
Scorpion,
Please don't cross post this, now the one who answers you has to watch that
he removes all the responding links.

A webpage is always one page(when we are not talking about frames and that
you do not), it has no pagebreaks.
Therefore I do not understand what you mean with pagebrakes.
I can think about 2 different things that you maybe want to do, but please
will you explain that first, before I make a complete novel.

Keywords: are printing or more webpages each after each other.

Cor
 
scorpion53061 said:
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.
 
scorpion53061 said:
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()

Hi,

We have recently released an HTML renderer called HTMLLabel which has
built-in support for pagination and allows far greater control over the
printing process than other browsers, including the ability to use HTML to
format headers and footers.

There is a VB.NET printing sample on our website at
http://www.htmllabel.com.

Dave Martin
Woodbury Associates Ltd.
 
Cor said:
This is VB.net newsgroup not for VB6 or HTML.

1) The original post asked about printing HTML with VB.NET.

2) The control that I mentioned is compatible with VB.NET.

I was merely trying to point the original poster to a possible solution.

Are you saying that because the control in question is for sale that it does
not constitute a valid response ?

Dave.
 
scorpion53061 said:
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.
 
Back
Top