By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,057 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,057 IT Pros & Developers. It's quick & easy.

Tables & Pagebreaks

P: n/a
I have had no luck in finding a good article that covers this exact
issue, so here I go!

I've made a Datagrid in C# within ASP.NET. So now on the client side
they get a table. Now this table is fairly long, about 20 or so
pages.....and all the columns fit fine, its just the height that I
have a problem with.

Viwing the table in IE has no problem. But when trying to print it
will often cut off in the middle of a row. I've given up trying to get
ASP.NET to fix this, and it seems that a stylesheet may be the
solution.

All users that will view my table use IE 6, so browser compatibility
is not an issue.

How can I get this to print properly? I've tried adding this:

<link rel="stylesheet" type="text/css" media="print" href="print.css"
/>

with my css file:
table
{
page-break-before: always
}

but that does nothing, any help?

thx
Jul 20 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a

"Gambit" <ba*******@hotmail.com> wrote in message
news:93***********************@posting.google.com. ..
I have had no luck in finding a good article that covers this exact
issue, so here I go!

I've made a Datagrid in C# within ASP.NET. So now on the client side
they get a table. Now this table is fairly long, about 20 or so
pages.....and all the columns fit fine, its just the height that I
have a problem with.

Viwing the table in IE has no problem. But when trying to print it
will often cut off in the middle of a row. I've given up trying to get
ASP.NET to fix this, and it seems that a stylesheet may be the
solution.

All users that will view my table use IE 6, so browser compatibility
is not an issue.

How can I get this to print properly? I've tried adding this:

<link rel="stylesheet" type="text/css" media="print" href="print.css"
/>

with my css file:
table
{
page-break-before: always
}

but that does nothing, any help?


This puts a page break before the table, but says nothing about what should
happen within your table that is long enough to have 19 page breaks inside
of it. You need

tr { page-break-inside: avoid; }

but IE doesn't support that property.

Jul 20 '05 #2

P: n/a
On 2 Feb 2004 14:10:33 -0800, ba*******@hotmail.com (Gambit) wrote:
I've made a Datagrid in C# within ASP.NET. So now on the client side
they get a table. Now this table is fairly long, about 20 or so
pages.....and all the columns fit fine, its just the height that I
have a problem with.

Viwing the table in IE has no problem. But when trying to print it
will often cut off in the middle of a row. I've given up trying to get
ASP.NET to fix this, and it seems that a stylesheet may be the
solution.

All users that will view my table use IE 6, so browser compatibility
is not an issue.


The presence or otherwise of C# and ASP.NET is irrelevant - that is
purely a server-side issue.

All browsers are poor at printing, sadly. (Unless the Mozillas of recent
months have improved - I haven't upgraded for a while, as I mainly use
Opera.)

I've been wrestling with one page of my own the last few days. The most
infuriating browser is Opera 7, which does a pretty good job as far as
the print preview is concerned, but screws up the inter-word spacing on
the actual printing.

The best (or least poor) browser I know of for printing is actually
Opera 6. You might like to try it.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #3

P: n/a
Oh this is just great. Also found out that IE doesn't support
"Landscape". And unfortunatly we are a MS house and stuck with MSCRM,
so I *have* to use IE.

So this case is hopeless? I simply can't believe that if you have a
table that extends past a page, you can't print it out properly. Or at
least no simple solution.

:(

-Gary

This puts a page break before the table, but says nothing about what should
happen within your table that is long enough to have 19 page breaks inside
of it. You need

tr { page-break-inside: avoid; }

but IE doesn't support that property.

Jul 20 '05 #4

P: n/a
Gambit wrote:
Oh this is just great. Also found out that IE doesn't support
"Landscape". And unfortunatly we are a MS house and stuck with MSCRM,
so I *have* to use IE.

[snip]

IE (5 & 6) on W2000 have "landscape" in their File > Page Setup dialogue.

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #5

P: n/a
Stephen Poley wrote:
On 2 Feb 2004 14:10:33 -0800, ba*******@hotmail.com (Gambit) wrote:
<printing> I've been wrestling with one page of my own the last few days. The most
infuriating browser is Opera 7, which does a pretty good job as far as
the print preview is concerned, but screws up the inter-word spacing on
the actual printing.


Make sure you've got the printer manufacturer's proper driver installed, I
noticed that printing was much improved overall when I removed the windows
automatic one and got one from HP, and Opera's word spacing is fine for
me, both on the print preview and on the printout. I didn't print from
Opera before I changed it, but Corel Draw and Word weren't doing very well
with words on the generic driver.

--
Matt

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #6

P: n/a
Gambit wrote:
Oh this is just great. Also found out that IE doesn't support
"Landscape". And unfortunatly we are a MS house and stuck with MSCRM,
so I *have* to use IE.

So this case is hopeless? I simply can't believe that if you have a
table that extends past a page, you can't print it out properly. Or at
least no simple solution.


Different approach (or, a poor hack). You could count words in the server
side script, and "guess" appropriate points for pagebreaks, and maybe make
this a printer friendly version (though I hate to say that) for the forced
IE users... horrible though, I know.

--
Matt
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #7

P: n/a
uhh.....ya I know, but to force IE to go into landscape mode when
printing is impossible via stylesheets.....
[snip]

IE (5 & 6) on W2000 have "landscape" in their File > Page Setup dialogue.

Jul 20 '05 #8

P: n/a
On Tue, 03 Feb 2004 20:25:29 +0000, Matt <ma**********@hotmail.com>
wrote:
Stephen Poley wrote:
On 2 Feb 2004 14:10:33 -0800, ba*******@hotmail.com (Gambit) wrote:

<printing>
I've been wrestling with one page of my own the last few days. The most
infuriating browser is Opera 7, which does a pretty good job as far as
the print preview is concerned, but screws up the inter-word spacing on
the actual printing.


Make sure you've got the printer manufacturer's proper driver installed, I
noticed that printing was much improved overall when I removed the windows
automatic one and got one from HP, and Opera's word spacing is fine for
me, both on the print preview and on the printout. I didn't print from
Opera before I changed it, but Corel Draw and Word weren't doing very well
with words on the generic driver.


Thanks for the suggestion, but I did that a long time ago - mine is also
an HP printer. I suppose I could check if there is a more recent driver
version. Word prints fine. As does Opera on some pages, but not others.
I haven't managed to work out what the common factor is yet.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #9

P: n/a

Gambit wrote:
*uhh.....ya I know, but to force IE to go into landscape mode when
printing is impossible via stylesheets..... *


You can use a third party ActiveX control with IE that enables you t
set some printing properties, such as portrait/landscape, via cod
rather providing instructions for users about changing the page setup.

The basic version is free.

To get a copy use the URLs below or search for Meadco ScriptX:
http://www.meadroid.com/scriptx/index.htm
http://msdn.microsoft.com/library/de.../dhtmlprint.as
To use it:
[1] Place the object tag in the web page.
<object id="factory" viewastext="true" style="display:none"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
codebase="../include/ScriptX.cab#Version=6,1,431,2">
</object>

[2] Create a function similar to the following:
function CustomPrint(pHeader, pFooter, blnPortrait, pLeftMargin
pRightMargin)
{
//save existing user's info
if (factory)
{
var original_h = factory.printing.header;
var original_f = factory.printing.footer;
var original_l = factory.printing.leftMargin;
var original_r = factory.printing.rightMargin;

//Set the page margins if supplied.
if (pLeftMargin != null)
factory.printing.leftMargin = pLeftMargin;
if (pRightMargin != null)
factory.printing.rightMargin = pRightMargin;

//set header and footer to blank
factory.printing.header = pHeader;
factory.printing.footer = pFooter;

//Set orientation.
factory.printing.portrait = blnPortrait;

//print page with prompt
factory.DoPrint(true);

//restore user's info
factory.printing.leftMargin = original_l;
factory.printing.rightMargin = original_r;
factory.printing.header = original_h;
factory.printing.footer = original_f;
}
else
window.print();
}

[3] Add a print button/link which calls this function

Ty7
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message40489.htm

Jul 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.