473,782 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Html table not proper in print preview

3 New Member
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 3909
Computer Guru
16 New Member
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 Recognized Expert Contributor
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
6507
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 a step beyond Notepad (not a WYSIWYG tool). Thanks.
81
5185
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 the blogs, and one definitely didn't print right. Surveying the web, my impression is that CSS is very unreliable, because even updated browsers fail to implement the standards correctly. So should one just avoid CSS? Or is it OK if used...
7
14370
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 display the graph but it is not possible to send query parameters to an OLE graph on a report (or programatically change any properties of an OLE Graph). However with a Form you do have the ability to change the RowSource of
9
9908
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 printer without any popups. the first parameter is the html file name(location) second is a switch that will tell the app to print in landscape or protrait. Basicly I when I type in (for example) PrintApp "c:\printthis.html" \L it should print the file...
2
14131
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 database? Thanks, Dean Slindee
1
2196
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 this username. 2. In main report's CategoryHeader_Format(), add a row to tblTOC with the current category name and the current page number. 3. In the table of contents subreport, Cancel if NoData event fires.
3
5289
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 render/understand HTML? Everything that I have seen looks like it will just print out the raw string and not the rendered HTML. I know I can do this with a WebBrowser Control and the
9
4078
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 so they don't print. Is that possible to do and if so can someone point me somewhere or show my a code snippet on how to do this?
42
8967
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 readable HTML? Santander
0
9641
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.