title: How do i generate a Word Document from JavaScript with changing page orientations? (portrait to landscape)
body: <p>Is it possible to create a Word document from JavaScript that contains 2 differently oriented pages (in the same document)?  I.e. 1st page = <i>portrait</i>, 2nd page = <i>landscape</i>?  This is pretty much exactly what I am after. I have tried so many things.. such as mso-break-type:section-break; mso-special-character:line-break; page-break-before:always; etc. but no luck.  Thank you in advance! Here is what i have so far:</p>
  
  <pre><code>&lt;script&gt;
  function export_to_word() {
     var link, blob, url;
     blob = new Blob(['\ufeff', document.getElementById("docx").innerHTML], {
           type: 'application/msword'
     });
     url = URL.createObjectURL(blob);
     link = document.createElement('A');
     link.href = url;
     link.download = 'Document';  // default name without extension 
     document.body.appendChild(link);
     if (navigator.msSaveOrOpenBlob )
          navigator.msSaveOrOpenBlob( blob, 'Document.doc'); // IE10-11
     else link.click();  // other browsers
     document.body.removeChild(link);
   };
  &lt;/script&gt;
  
  &lt;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"&gt;
  
  &lt;br&gt;
  &lt;button onclick="export_to_word()"&gt;Export&lt;/button&gt;
  
  &lt;div id="docx"&gt;
  
      &lt;style&gt;
          @page portrait_A4_page {
              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.portrait_A4_page { page:portrait_A4_page; }
  
          @page landscape_A4_page {
              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.landscape_A4_page { page:landscape_A4_page; }
  
      &lt;/style&gt;
  
  
      &lt;div class=portrait_A4_page&gt;
          &lt;p&gt;standard A4 portrait page information&lt;/p&gt;
      &lt;/div&gt;    
  
      &lt;div class=landscape_A4_page&gt;
          &lt;table border=1&gt;
            &lt;tr&gt;
              &lt;td&gt;a table that goes really wide&lt;/td&gt;  
            &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>