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

Header problem in word document print layout

P: 10
Hi,
I have to create word document with header and footer..its working in web layout.In Print Layput,the header is displayed two times..Plz give me the solution...its very urgent..

Expand|Select|Wrap|Line Numbers
  1.  
  2. strBody = "<html xmlns:o='urn:schemas-microsoft-com:office:office' " & _ 
  3. "xmlns:w='urn:schemas-microsoft-com:office:word'" & _ 
  4. "xmlns='http://www.w3.org/TR/REC-html40'>"
  5. strBody = strBody + "<!--[if gte mso 9]>" & _
  6. "<xml>" & _
  7. "<w:WordDocument>" & _
  8. "<w:View>Print</w:View>" & _
  9. "<w:Zoom>100</w:Zoom>" & _
  10. "<w:DoNotOptimizeForBrowser/>" & _
  11. "</w:WordDocument>" & _
  12. "</xml>" & _
  13. "<![endif]-->"
  14.  
  15. strBody = strBody + "<style>" & _
  16. "<!-- /* Style Definitions */" & _
  17. "p.MsoFooter, li.MsoFooter, div.MsoFooter" & _
  18. "{margin:0in;" & _
  19. "margin-bottom:.0001pt;" & _
  20. "mso-pagination:widow-orphan;" & _
  21. "tab-stops:center 1.0in right 1.0in;" & _
  22. "font-size:10.0pt;}"
  23.  
  24.  
  25.  
  26. strBody = strBody + "@page Section1" & _
  27. " {size:8.8in 12.0in; " & _
  28. " mso-header: h1;" & _
  29. " mso-footer: f1;" & _
  30. " mso-footer-margin:.4in; mso-paper-source:0;}" & _
  31. " div.Section1" & _
  32. " {page:Section1;}" & _
  33. "-->" & _
  34. "</style></head>"
  35. strBody = strBody + "<body>"
  36. 'strBody = strBody + "<div>"
  37. strBody = strBody + "<div class=Section1 style='mso-element:header' id=h1>" & _
  38. " <p class=MsoHeader align=left>" & _
  39. " <span style='mso-tab-count:2'></span><span style='mso-field-code:'>" & _
  40. "<table width='98%' border='1' align = 'center'>" & _
  41. "<tr bgcolor=white>" & _
  42. "<td width=33% align=center><img border=0 src='../../../images/tele.jpg'></td>" & _
  43. "<td width=33% align=center>" & _
  44. "<font color=blue face=verdana size=5>Built Release Form</font>" & _
  45. "</td>" & _
  46. "<td width=33% align=center>Page " & _ 
  47. "<span style='mso-field-code:"" Page ""'></span>" &_ 
  48. "</td>" & _
  49. "</tr>" & _
  50. "</table>" & _
  51. "</span>" & _
  52. " </p></div>"
  53. strBody = strBody + lPageVar 
  54. strBody = strBody + "<div style='mso-element:footer' id=f1>" & _
  55. " <p class=MsoFooter align=center>" & _
  56. " <span style='mso-tab-count:2'><span style='mso-field-code:'>" & strFooter & "</span>" & _
  57. " </p></div>" & _
  58. "</body>"
  59. Response.Buffer = True
  60. Response.ContentType = "application/vnd.ms-word"
  61. Response.AddHeader "content-disposition", "inline; filename = BuildReleaseForm.doc"
  62. %>
  63.  
  64. <%
  65. Response.Write(strBody)
  66. Response.End
  67.  
  68. %>
  69.  
Thanks
Krish
Apr 25 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

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