I have a problem to add header and footer section when you generate
dynamically a word document  .

the below code it comes header with text and footer with page number
but in last page in a word document .
the header with text is showing in the body section (i.e inside the
paragraph ). how to avoid this

my code is:
paragraph

html.Append("<html " & _
             "xmlns:o='urn:schemas-microsoft-com:office:office' " & _
             "xmlns:w='urn:schemas-microsoft-com:office:word'" & _
             "xmlns='http://www.w3.org/TR/REC-html40'>" & _
             "<head><title>Time</title>")

            'The setting specifies document's view after it is
downloaded as Print
            'instead of the default Web Layout
            html.Append("<!--[if gte mso 9]>" & _
                                     "<xml>" & _
                                     "<w:WordDocument>" & _
                                     "<w:View>Print</w:View>" & _
                                     "<w:Zoom>90</w:Zoom>" & _
                                     "<w:DoNotOptimizeForBrowser/>" &
_
                                     "</w:WordDocument>" & _
                                     "</xml>" & _
                                     "<![endif]-->")

            html.Append("<style>" & _
                                    "<!-- /* Style Definitions */" & _
                                    "p.MsoFooter, li.MsoFooter,
div.MsoFooter" & _
                                    "{margin:0in;" & _
                                    "margin-bottom:.0001pt;" & _
                                    "mso-pagination:widow-orphan;" & _
                                    "tab-stops:center 3.0in right
6.0in;" & _
                                    "font-size:12.0pt;}" & _
                                    "p.MsoHeader, li.MsoHeader,
div.MsoHeader" & _
                                    "{margin:0in;" & _
                                    "margin-bottom:.0001pt;" & _
                                    "mso-pagination:widow-orphan;" & _
                                    "tab-stops:center 3.0in right
6.0in;" & _
                                    "font-size:10.0pt; " & _
                                    "font-family:'Times New Roman';}"
& _
                                    "@page Section1" & _
                                    "   {size:8.5in 11.0in; " & _
                                    "   margin:1.0in 1.25in 1.0in
1.25in ; " & _
                                    "   mso-header-margin:.5in; " & _
                                    "mso-footer: f1;" & _
                                    "mso-header: h1;" & _
                                    "mso-footer-margin:.5in; mso-paper-
source:0;}" & _
                                    " div.Section1" & _
                                    "   {page:Section1;}" & _
                                    "-->" & _
                                   "</style></head>")

            html.Append("<body lang=EN-US style='tab-interval:.5in'>"
& _
                                    "<div class=Section1>" & _
                                     FCKeditor1.Value)

            html.Append("<div style='mso-element:header' id=h1>" & _
                                "<p class=MsoHeader>Test" & _
                              "<span style='mso-field-code:""  ""'></
span> " & _
                              "</p>" & _
                              "</div>")

            html.Append("<div style='mso-element:footer;margin-
left:auto' id=f1 >" & _
                                   " <p class=MsoFooter> " & _
                                    " <span style='mso-tab-count:2'></
span>test<span style='mso-field-code:"" PAGE ""'></span>" & _
                                    " </p></div>" & _
                                    "</div></body></html>")

Reply via email to