• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

print

New Here ,
Jan 18, 2007 Jan 18, 2007

Copy link to clipboard

Copied

Hi i have a print page which prints all viewed on the page displayed.

is it posible to specify only a table to print ie i have 2 table on the page but i only want tp print 1 table


<body onLoad="window.print();">
TOPICS
Advanced techniques

Views

608

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 18, 2007 Jan 18, 2007

Copy link to clipboard

Copied

Generally, what-you-see-is-what-you-print. Sure, you can have several tables on a page, and if you hide them with CSS, chances are that they aren't printed either.

So, my answer would be "No."

You could have a "print" button on the page, opening the page with a url parameter which prevents the second table from appearing.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 18, 2007 Jan 18, 2007

Copy link to clipboard

Copied

Generally, what-you-see-is-what-you-print. Sure, you can have several
tables on a page, and if you hide them with CSS, chances are that they
aren't printed either.

So, my answer would be "No."

Actually the answer is yes. You use the media property of the CSS style
tag. I do this all the time. This allows you to specify different CSS
for different media.



<style media="print">
.hide {display: none}
</style>


<table class="hide" ...>
...
</table>

This table will not print in browsers that understand the CSS standard.
But will show on the screen as long as you do not hide it with other CSS.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 18, 2007 Jan 18, 2007

Copy link to clipboard

Copied

Thanks Ian, works great

just one more question,

when i use the print function it adds a header and a footer to the page

header = page 1 of 1
footer = www.website.com/page.cfm

can i also stop these from appearing?

thanks once again

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 18, 2007 Jan 18, 2007

Copy link to clipboard

Copied

can i also stop these from appearing?


Sure just add the class="hide" to any container or tag and it will not
be printed.

You can take this quite a bit farther if you like, resizing elements,
changing colors, rearranging layout and more. By defining some CSS in a
<script media="all"> (the default if media is not defined) <script
media="screen"> and <script media="print"> you can create some very
sophisticated layout changes between print and screen.

I just wish IE supported more of the CSS standard on this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 18, 2007 Jan 18, 2007

Copy link to clipboard

Copied

Hi once again thanks, is there there a website or book i can buy with all this in that you recomend?

on the last post the header and footer are printed automatically, they are not displayed on the web page view

it adds in
header = page 1 of 1
footer = www.website.com/page.cfm

so how do i use the hide function if i cant actually see it on the webpage?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 18, 2007 Jan 18, 2007

Copy link to clipboard

Copied

The headers and footers are most likely the stuff you can see for example in Firefox menu File -> Page Setup. This time I'd say for sure you can't hide those. It's entirely a client-side (browser) configuration issue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 19, 2007 Jan 19, 2007

Copy link to clipboard

Copied

LATEST
Ferris is correct, those are client side browser settings. You have
very LITTLE control over those from the sever.

There are some activeX controls that supposedly allow you some control
over these if you have a Microsoft server and the client is using a
Microsoft browser. But I have never bothered with them so do not know
anything about their effectiveness and ease of use.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 18, 2007 Jan 18, 2007

Copy link to clipboard

Copied

I have to agree, and stand corrected. I was very well aware of the css feature, but never really trusted it works on all browsers. To my surprise, it works on MSIE 6 too, thus it's ok to use it. 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation