/    Sign up×
Community /Pin to ProfileBookmark

How to print table header on each page??

I have a table that is being populated with data from the database tables..

so it is difficult to determine, how many rows will i have within a page because the data varies and spills over to another row.

Is there a way of printing table header on each page when someone prints the report?

Any help on this will be highly appreciated.

THank you in advance,

to post a comment
HTML

8 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliJul 07.2003 — read up on css@page rules
Copy linkTweet thisAlerts:
@HesterJul 08.2003 — Maybe you could use a hidden div that only shows up in the print css file?
Copy linkTweet thisAlerts:
@cakedayauthorJul 08.2003 — HESTER,

what do you mean when you said, "hidden div that only shows up in the print css file?"

If you can, can you please give me an example..

Thank you!
Copy linkTweet thisAlerts:
@HesterJul 08.2003 — In your page put something like this:
<div id="hidden">My Report</div>
Then in Notepad type this:
#hidden {display:none;}

Save this as a text file with extension .css and link to it like this:
<html>
<head>

<link rel="stylesheet" href="filename.css" type="text/css" media="screen, projection" />

</head>

Now make a new stylesheet but with this in it instead:
#hidden {position:absolute; top:0px; left:400px;}
I know this is a poor example folks, but it does the trick. This puts the text "My Report" at the top of the page, 400 pixels in. Mind you, it will only work on one page for now.

Add this to the head in your document now:
<link rel="stylesheet" href="printer.css" type="text/css" media="print" />
Now the printer only gets this file! On screen, the header "My Report" is hidden.

Can anyone think of a way to adapt this to work on multiple pages?
Copy linkTweet thisAlerts:
@DaveSWJul 08.2003 — [i]Originally posted by Hester [/i]

[B]Can anyone think of a way to adapt this to work on multiple pages? [/B][/QUOTE]


Not offhand. Unless I'm missing something.

I've been puzzling over Khalid's reply, and what I think he means is this. With the @page rule and other related css you can specify [B]where[/B] your table breaks. So then you could maybe repeat the headings in the code, and let the code break up the table for you.
Copy linkTweet thisAlerts:
@cakedayauthorJul 09.2003 — Thank you HESTER, hidden div is exactly what i needed.. Thank you!!
Copy linkTweet thisAlerts:
@cakedayauthorJul 09.2003 — Now, i want to do the opposite of what i had requested earlier..

Now, i want some text lets say - THE REPORT - to show on the screen but then i want to hide it when it prints..

Any help will be higly appreciated..

THank you!
Copy linkTweet thisAlerts:
@FangJul 10.2003 — This in the <style>

@media print {

#heading {display:none; }

}
[/QUOTE]

and in the <body>

<div id="heading">THE REPORT<div>
[/QUOTE]
×

Success!

Help @cakeday spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...