Search code examples
htmlms-word.doc

HTML to landscape MS Word


MS Word can interpret HTML as a document, but I want to specify in the HTML code to display it in landscaped letter pages. Is it possible?


Solution

  • <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html xmlns:office="urn:schemas-microsoft-com:office:office"
          xmlns:word="urn:schemas-microsoft-com:office:word"
          xmlns="http://www.w3.org/TR/REC-html40">
    
    <head>
    <style>        
    @page Section1 {size:595.45pt 841.7pt; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}
            div.Section1 {page:Section1;}
            @page Section2 {size:841.7pt 595.45pt;mso-page-orientation:landscape;margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}
            div.Section2 {page:Section2;}
    
    </style>
    </head>
    <body>
    
    <div class=Section2>
    <!--your content here-->
    </div>
    </body>
    </html>