473,395 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Html table not proper in print preview

3
Hi,
I have a html page where in the table spans for two pages
the first page's last row doesn end properly and the 2nd page's first row also isnt proper.The code i use is given below,the no of pages the table will spread over is dyanmically decided,

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <style>
  4.  
  5. tHead
  6. {
  7.   display : table-header-group;
  8. }
  9.  
  10.  
  11. </style>
  12. </head>
  13. <script>
  14.  
  15. function AddTHEAD(tableName)
  16. {
  17.    var table = document.getElementById(tableName); 
  18.    if(table != null) 
  19.    {
  20.     var head = document.createElement("THEAD");
  21.     head.style.display = "table-header-group";
  22.     head.appendChild(table.rows[0]);
  23.     table.insertBefore(head, table.childNodes[0]); 
  24.    }
  25.  
  26. }
  27. </script>
  28. <body onload="javascript: AddTHEAD('DataGrid')">
  29.  
  30. <table border="1" id="DataGrid">
  31.  
  32. <tr>
  33. <th>Heading</th>
  34. <th>Another Heading</th>
  35. </tr>
  36.  
  37. <tr>
  38. <td>row 1, cell 1</td>
  39. <td>row 1, cell 2</td>
  40. </tr>
  41. <tr>
  42. <td>row 2, cell 1</td>
  43. <td>row 2, cell 2</td>
  44. </tr>
  45. <tr>
  46. <td>row 2, cell 1</td>
  47. <td>row 2, cell 2</td>
  48.  
  49. </tr>
  50. <tr>
  51. <td>row 2, cell 1</td>
  52. <td>row 2, cell 2</td>
  53. </tr>
  54. <tr>
  55. <td>row 2, cell 1</td>
  56. <td>row 2, cell 2</td>
  57. </tr>
  58. <tr>
  59. <td>row 2, cell 1</td>
  60. <td>row 2, cell 2</td>
  61.  
  62. </tr>
  63. <tr>
  64. <td>row 2, cell 1</td>
  65. <td>row 2, cell 2</td>
  66. </tr>
  67. <tr>
  68. <td>row 2, cell 1</td>
  69. <td>row 2, cell 2</td>
  70. </tr>
  71. <tr>
  72. <td>row 2, cell 1</td>
  73. <td>row 2, cell 2</td>
  74.  
  75. </tr>
  76. <tr>
  77. <td>row 2, cell 1</td>
  78. <td>row 2, cell 2</td>
  79. </tr>
  80. <tr>
  81. <td>row 2, cell 1</td>
  82. <td>row 2, cell 2</td>
  83. </tr>
  84. <tr>
  85. <td>row 2, cell 1</td>
  86. <td>row 2, cell 2</td>
  87.  
  88. </tr>
  89. <tr>
  90. <td>row 2, cell 1</td>
  91. <td>row 2, cell 2</td>
  92. </tr>
  93. <tr>
  94. <td>row 2, cell 1</td>
  95. <td>row 2, cell 2</td>
  96. </tr>
  97. <tr>
  98. <td>row 2, cell 1</td>
  99. <td>row 2, cell 2</td>
  100.  
  101. </tr>
  102. <tr>
  103. <td>row 2, cell 1</td>
  104. <td>row 2, cell 2</td>
  105. </tr>
  106. <tr>
  107. <td>row 2, cell 1</td>
  108. <td>row 2, cell 2</td>
  109. </tr>
  110. <tr>
  111. <td>row 2, cell 1</td>
  112. <td>row 2, cell 2</td>
  113.  
  114. </tr>
  115. <tr>
  116. <td>row 2, cell 1</td>
  117. <td>row 2, cell 2</td>
  118. </tr>
  119. <tr>
  120. <td>row 2, cell 1</td>
  121. <td>row 2, cell 2</td>
  122. </tr>
  123. <tr>
  124. <td>row 2, cell 1</td>
  125. <td>row 2, cell 2</td>
  126.  
  127. </tr>
  128. <tr>
  129. <td>row 2, cell 1</td>
  130. <td>row 2, cell 2</td>
  131. </tr>
  132. <tr>
  133. <td>row 2, cell 1</td>
  134. <td>row 2, cell 2</td>
  135. </tr>
  136. <tr>
  137. <td>row 2, cell 1</td>
  138. <td>row 2, cell 2</td>
  139.  
  140. </tr>
  141. <tr>
  142. <td>row 2, cell 1</td>
  143. <td>row 2, cell 2</td>
  144. </tr>
  145. <tr>
  146. <td>row 2, cell 1</td>
  147. <td>row 2, cell 2</td>
  148. </tr>
  149. <tr>
  150. <td>row 2, cell 1</td>
  151. <td>row 2, cell 2</td>
  152.  
  153. </tr>
  154. <tr>
  155. <td>row 2, cell 1</td>
  156. <td>row 2, cell 2</td>
  157. </tr>
  158. <tr>
  159. <td>row 2, cell 1</td>
  160. <td>row 2, cell 2</td>
  161. </tr>
  162. <tr>
  163. <td>row 2, cell 1</td>
  164. <td>row 2, cell 2</td>
  165.  
  166. </tr>
  167. <tr>
  168. <td>row 2, cell 1</td>
  169. <td>row 2, cell 2</td>
  170. </tr>
  171. <tr>
  172. <td>row 2, cell 1</td>
  173. <td>row 2, cell 2</td>
  174. </tr>
  175. <tr>
  176. <td>row 2, cell 1</td>
  177. <td>row 2, cell 2</td>
  178.  
  179. </tr>
  180. <tr>
  181. <td>row 2, cell 1</td>
  182. <td>row 2, cell 2</td>
  183. </tr>
  184. <tr>
  185. <td>row 2, cell 1</td>
  186. <td>row 2, cell 2</td>
  187. </tr>
  188. <tr>
  189. <td>row 2, cell 1</td>
  190. <td>row 2, cell 2</td>
  191.  
  192. </tr>
  193. <tr>
  194. <td>row 2, cell 1</td>
  195. <td>row 2, cell 2</td>
  196. </tr>
  197. <tr>
  198. <td>row 2, cell 1</td>
  199. <td>row 2, cell 2</td>
  200. </tr>
  201. <tr>
  202. <td>row 2, cell 1</td>
  203. <td>row 2, cell 2</td>
  204.  
  205. </tr>
  206. <tr>
  207. <td>row 2, cell 1</td>
  208. <td>row 2, cell 2</td>
  209. </tr>
  210. <tr>
  211. <td>row 2, cell 1</td>
  212. <td>row 2, cell 2</td>
  213. </tr>
  214. <tr>
  215. <td>row 2, cell 1</td>
  216. <td>row 2, cell 2</td>
  217.  
  218. </tr>
  219. <tr>
  220. <td>row 2, cell 1</td>
  221. <td>row 2, cell 2</td>
  222. </tr>
  223. <tr>
  224. <td>row 2, cell 1</td>
  225. <td>row 2, cell 2</td>
  226. </tr>
  227. <tr>
  228. <td>row 2, cell 1</td>
  229. <td>row 2, cell 2</td>
  230.  
  231. </tr>
  232. <tr>
  233. <td>row 2, cell 1</td>
  234. <td>row 2, cell 2</td>
  235. </tr>
  236. <tr>
  237. <td>row 2, cell 1</td>
  238. <td>row 2, cell 2</td>
  239. </tr>
  240. <tr>
  241. <td>row 2, cell 1</td>
  242. <td>row 2, cell 2</td>
  243.  
  244. </tr>
  245. <tr>
  246. <td>row 2, cell 1</td>
  247. <td>row 2, cell 2</td>
  248. </tr>
  249. <tr>
  250. <td>row 2, cell 1</td>
  251. <td>row 2, cell 2</td>
  252. </tr>
  253. <tr>
  254. <td>row 2, cell 1</td>
  255. <td>row 2, cell 2</td>
  256.  
  257. </tr>
  258. <tr>
  259. <td>row 2, cell 1</td>
  260. <td>row 2, cell 2</td>
  261. </tr>
  262.  
  263.  
  264.  
  265. </table>
  266. </body>
  267. </html>

Thanks
Albin
Mar 28 '08 #1
2 3860
Honestly I can't find anything wrong with it. It may look a little awkward at the end of the page but it is not very noticeable. If you are really having problems with it, I suggest putting a page break before the table or making two tables. I can't seem to recreate your error. If your page is published you could post the link and I could take a look at it else you're on your own.

Computer Guru
Jun 26 '08 #2
eWish
971 Expert 512MB
Must be an IE issue. I am looking at it in FireFox 3 and no problems. I looked at it in IE and it does have issues. Here is an article that may help you with this.

--Kevin
Jun 26 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

71
by: tomy_baseo | last post by:
I'm new to HTML and want to learn the basics by learning to code by hand (with the assistance of an HTML editor to eliminate repetitive tasks). Can anyone recommend a good, basic HTML editor that's...
81
by: sinister | last post by:
I wanted to spiff up my overly spartan homepage, and started using some CSS templates I found on a couple of weblogs. It looks fine in my browser (IE 6.0), but it doesn't print right. I tested...
7
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to...
9
by: Sean McKaharay | last post by:
Since no one can answer the following question: I have a issue. I need to create a command line application/or windows application that will take 2 parameters and will print to the default...
2
by: Dean Slindee | last post by:
Anybody written code in VB.NET to: 1) show a print preview window of reports already written and stored in an Access 2002 database; or 2) execute the print of a report stored in an Access 2002...
1
by: Beowulf | last post by:
I have a report laid out in Design View as shown at the end of this message. I have code that performs the following steps: 1. In main report's Report_Open(), DELETE any old rows in tblTOC for...
3
by: dvdastor | last post by:
Hello, Is there a way that anyone knows of to preview an HTML string and have it formatted as HTML in a PrintPreviewDialog? In other words, can the PrintDocument that is required for this...
9
by: igotyourdotnet | last post by:
I need to create a print preview page BUT my page I need to print has a grid and in the grid I have 2 or 3 columns that have links I want to hide the columns with the links on my print preview page...
42
by: Santander | last post by:
how to decode HTML pages encoded like this: http://www.long2consulting.com/seeinaction2008/Simplicity_Beach_table/index.htm Is there script that will do this automatically and generate normal fully...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.