473,382 Members | 1,329 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,382 software developers and data experts.

Header problem in word document print layout

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
0 2195

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

Similar topics

3
by: MostlyH2O | last post by:
Hi Folks, I am trying to output the content of my ASP page to an MS Word Document with a specific page size (8.5x11) and margins (.25" all around). I have used the Response.ContentType =...
3
by: Brian Kwan | last post by:
Project Description: Develop a web application to help manage sale operations. There is a function that to generate a report using data in database, which is a Word document on server and let user...
3
by: Susan Bricker | last post by:
Greetings. I have a command button that, when clicked, opens up an instance of MS/Word and opens a document (the filename is the input argument to the function that is kicked off"). This works...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
0
by: srk | last post by:
hi to all, i need some help , my problem is that i have to generate a word document withe the data from data base and it should be displayed as tables in word and i have to insert some header and...
0
by: 5anelli | last post by:
Hi to everyone, I need to create and print (from within a c# application) a MS Word document starting from an Access db. Half of this document must be written and printed in, let's say, January,...
1
by: vanand | last post by:
hai, I have wanted to print the data in word document from vb. Now i can able to print the data from database to word without format layout. I need to format the data in word. Kindly send your...
1
by: fauxanadu | last post by:
I have a new document open in print layout. Then I attempt to insert an autoshape into the document. As soon as I click on the shape I want to input, word swaps into web layout and does nothing...
0
by: Julia1 | last post by:
Actually I have encountered several problems working with Word. Please see if you can help me resolve them. My application creates documents (Microsoft.Interop.Word.Document) each one according...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.