HTML to MS Word doc with total number of pages












1















I am trying to create a Word document using HTML.



Thanks to a number of examples I have been able to acheive this. However, I can't seem to place the total number of pages in text at the top of the first page in the document.



I am trying to add, "This document contains "PAGENUM" of pages in the first line of text, but when the document is created, the "PAGENUM" is blank (other than in the footer that I also would like to keep).



Is what I'm trying to achieve even possible or am I just getting it completely wrong?



My code (Thanks to another user Vahid) is as follows,



<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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>

<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Print</w:View>
<w:Zoom>100</w:Zoom>
</w:WordDocument>
</xml><![endif]-->
<style>
<!-- /* Style Definitions */
p.MsoHeader, li.MsoHeader, div.MsoHeader{
margin:0in;
margin-top:.0001pt;
mso-pagination:widow-orphan;
tab-stops:center 3.0in right 6.0in;
}
p.MsoFooter, li.MsoFooter, div.MsoFooter{
margin:0in 0in 1in 0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:center 3.0in right 6.0in;
}
.footer {
font-size: 9pt;
}
@page Section1{
size:8.5in 11.0in;
margin:0.5in 0.5in 0.5in 0.5in;
mso-header-margin:0.5in;
mso-header:h1;
mso-footer:f1;
mso-footer-margin:0.5in;
mso-paper-source:0;
}
div.Section1{
page:Section1;
}
table#hrdftrtbl{
margin:0in 0in 0in 9in;
}
-->
</style>
<style type="text/css" media="screen,print">
body {
font-family: "Calibri", "Verdana","HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-size:12pt;
}
pageBreak {
clear:all;
page-break-before:always;
mso-special-character:line-break;
}
</style>
</head>
<body style='tab-interval:.5in'>
<div class="Section1">

This document contains <span style='mso-field-code: NUMPAGES '></span> pages.

MORE CONTENT

<table id='hrdftrtbl' border='1' cellspacing='0' cellpadding='0'>
<tr>
<td>
<div style='mso-element:header' id="h1" >
<p class="MsoHeader">
<table border="0" width="100%">
<tr>
<td>

YOUR_HEADER IMAGE/TEXT

</td>
</tr>
</table>
</p>
</div>
</td>
<td>
<div style='mso-element:footer' id="f1">
<p class="MsoFooter">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" class="footer">
YOUR_FOOTER_TEXT
<g:message code="offer.letter.page.label"/> <span style='mso-field-code: PAGE '></span> of <span style='mso-field-code: NUMPAGES '></span>
</td>
</tr>
</table>
</p>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>


Thanks in advance.










share|improve this question





























    1















    I am trying to create a Word document using HTML.



    Thanks to a number of examples I have been able to acheive this. However, I can't seem to place the total number of pages in text at the top of the first page in the document.



    I am trying to add, "This document contains "PAGENUM" of pages in the first line of text, but when the document is created, the "PAGENUM" is blank (other than in the footer that I also would like to keep).



    Is what I'm trying to achieve even possible or am I just getting it completely wrong?



    My code (Thanks to another user Vahid) is as follows,



    <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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>

    <!--[if gte mso 9]><xml>
    <w:WordDocument>
    <w:View>Print</w:View>
    <w:Zoom>100</w:Zoom>
    </w:WordDocument>
    </xml><![endif]-->
    <style>
    <!-- /* Style Definitions */
    p.MsoHeader, li.MsoHeader, div.MsoHeader{
    margin:0in;
    margin-top:.0001pt;
    mso-pagination:widow-orphan;
    tab-stops:center 3.0in right 6.0in;
    }
    p.MsoFooter, li.MsoFooter, div.MsoFooter{
    margin:0in 0in 1in 0in;
    margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    tab-stops:center 3.0in right 6.0in;
    }
    .footer {
    font-size: 9pt;
    }
    @page Section1{
    size:8.5in 11.0in;
    margin:0.5in 0.5in 0.5in 0.5in;
    mso-header-margin:0.5in;
    mso-header:h1;
    mso-footer:f1;
    mso-footer-margin:0.5in;
    mso-paper-source:0;
    }
    div.Section1{
    page:Section1;
    }
    table#hrdftrtbl{
    margin:0in 0in 0in 9in;
    }
    -->
    </style>
    <style type="text/css" media="screen,print">
    body {
    font-family: "Calibri", "Verdana","HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    font-size:12pt;
    }
    pageBreak {
    clear:all;
    page-break-before:always;
    mso-special-character:line-break;
    }
    </style>
    </head>
    <body style='tab-interval:.5in'>
    <div class="Section1">

    This document contains <span style='mso-field-code: NUMPAGES '></span> pages.

    MORE CONTENT

    <table id='hrdftrtbl' border='1' cellspacing='0' cellpadding='0'>
    <tr>
    <td>
    <div style='mso-element:header' id="h1" >
    <p class="MsoHeader">
    <table border="0" width="100%">
    <tr>
    <td>

    YOUR_HEADER IMAGE/TEXT

    </td>
    </tr>
    </table>
    </p>
    </div>
    </td>
    <td>
    <div style='mso-element:footer' id="f1">
    <p class="MsoFooter">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td align="center" class="footer">
    YOUR_FOOTER_TEXT
    <g:message code="offer.letter.page.label"/> <span style='mso-field-code: PAGE '></span> of <span style='mso-field-code: NUMPAGES '></span>
    </td>
    </tr>
    </table>
    </p>
    </div>
    </td>
    </tr>
    </table>
    </div>
    </body>
    </html>


    Thanks in advance.










    share|improve this question



























      1












      1








      1








      I am trying to create a Word document using HTML.



      Thanks to a number of examples I have been able to acheive this. However, I can't seem to place the total number of pages in text at the top of the first page in the document.



      I am trying to add, "This document contains "PAGENUM" of pages in the first line of text, but when the document is created, the "PAGENUM" is blank (other than in the footer that I also would like to keep).



      Is what I'm trying to achieve even possible or am I just getting it completely wrong?



      My code (Thanks to another user Vahid) is as follows,



      <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>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <title></title>

      <!--[if gte mso 9]><xml>
      <w:WordDocument>
      <w:View>Print</w:View>
      <w:Zoom>100</w:Zoom>
      </w:WordDocument>
      </xml><![endif]-->
      <style>
      <!-- /* Style Definitions */
      p.MsoHeader, li.MsoHeader, div.MsoHeader{
      margin:0in;
      margin-top:.0001pt;
      mso-pagination:widow-orphan;
      tab-stops:center 3.0in right 6.0in;
      }
      p.MsoFooter, li.MsoFooter, div.MsoFooter{
      margin:0in 0in 1in 0in;
      margin-bottom:.0001pt;
      mso-pagination:widow-orphan;
      tab-stops:center 3.0in right 6.0in;
      }
      .footer {
      font-size: 9pt;
      }
      @page Section1{
      size:8.5in 11.0in;
      margin:0.5in 0.5in 0.5in 0.5in;
      mso-header-margin:0.5in;
      mso-header:h1;
      mso-footer:f1;
      mso-footer-margin:0.5in;
      mso-paper-source:0;
      }
      div.Section1{
      page:Section1;
      }
      table#hrdftrtbl{
      margin:0in 0in 0in 9in;
      }
      -->
      </style>
      <style type="text/css" media="screen,print">
      body {
      font-family: "Calibri", "Verdana","HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
      font-size:12pt;
      }
      pageBreak {
      clear:all;
      page-break-before:always;
      mso-special-character:line-break;
      }
      </style>
      </head>
      <body style='tab-interval:.5in'>
      <div class="Section1">

      This document contains <span style='mso-field-code: NUMPAGES '></span> pages.

      MORE CONTENT

      <table id='hrdftrtbl' border='1' cellspacing='0' cellpadding='0'>
      <tr>
      <td>
      <div style='mso-element:header' id="h1" >
      <p class="MsoHeader">
      <table border="0" width="100%">
      <tr>
      <td>

      YOUR_HEADER IMAGE/TEXT

      </td>
      </tr>
      </table>
      </p>
      </div>
      </td>
      <td>
      <div style='mso-element:footer' id="f1">
      <p class="MsoFooter">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td align="center" class="footer">
      YOUR_FOOTER_TEXT
      <g:message code="offer.letter.page.label"/> <span style='mso-field-code: PAGE '></span> of <span style='mso-field-code: NUMPAGES '></span>
      </td>
      </tr>
      </table>
      </p>
      </div>
      </td>
      </tr>
      </table>
      </div>
      </body>
      </html>


      Thanks in advance.










      share|improve this question
















      I am trying to create a Word document using HTML.



      Thanks to a number of examples I have been able to acheive this. However, I can't seem to place the total number of pages in text at the top of the first page in the document.



      I am trying to add, "This document contains "PAGENUM" of pages in the first line of text, but when the document is created, the "PAGENUM" is blank (other than in the footer that I also would like to keep).



      Is what I'm trying to achieve even possible or am I just getting it completely wrong?



      My code (Thanks to another user Vahid) is as follows,



      <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>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <title></title>

      <!--[if gte mso 9]><xml>
      <w:WordDocument>
      <w:View>Print</w:View>
      <w:Zoom>100</w:Zoom>
      </w:WordDocument>
      </xml><![endif]-->
      <style>
      <!-- /* Style Definitions */
      p.MsoHeader, li.MsoHeader, div.MsoHeader{
      margin:0in;
      margin-top:.0001pt;
      mso-pagination:widow-orphan;
      tab-stops:center 3.0in right 6.0in;
      }
      p.MsoFooter, li.MsoFooter, div.MsoFooter{
      margin:0in 0in 1in 0in;
      margin-bottom:.0001pt;
      mso-pagination:widow-orphan;
      tab-stops:center 3.0in right 6.0in;
      }
      .footer {
      font-size: 9pt;
      }
      @page Section1{
      size:8.5in 11.0in;
      margin:0.5in 0.5in 0.5in 0.5in;
      mso-header-margin:0.5in;
      mso-header:h1;
      mso-footer:f1;
      mso-footer-margin:0.5in;
      mso-paper-source:0;
      }
      div.Section1{
      page:Section1;
      }
      table#hrdftrtbl{
      margin:0in 0in 0in 9in;
      }
      -->
      </style>
      <style type="text/css" media="screen,print">
      body {
      font-family: "Calibri", "Verdana","HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
      font-size:12pt;
      }
      pageBreak {
      clear:all;
      page-break-before:always;
      mso-special-character:line-break;
      }
      </style>
      </head>
      <body style='tab-interval:.5in'>
      <div class="Section1">

      This document contains <span style='mso-field-code: NUMPAGES '></span> pages.

      MORE CONTENT

      <table id='hrdftrtbl' border='1' cellspacing='0' cellpadding='0'>
      <tr>
      <td>
      <div style='mso-element:header' id="h1" >
      <p class="MsoHeader">
      <table border="0" width="100%">
      <tr>
      <td>

      YOUR_HEADER IMAGE/TEXT

      </td>
      </tr>
      </table>
      </p>
      </div>
      </td>
      <td>
      <div style='mso-element:footer' id="f1">
      <p class="MsoFooter">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td align="center" class="footer">
      YOUR_FOOTER_TEXT
      <g:message code="offer.letter.page.label"/> <span style='mso-field-code: PAGE '></span> of <span style='mso-field-code: NUMPAGES '></span>
      </td>
      </tr>
      </table>
      </p>
      </div>
      </td>
      </tr>
      </table>
      </div>
      </body>
      </html>


      Thanks in advance.







      php html






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 17:53









      FloT

      269112




      269112










      asked Nov 23 '18 at 13:21









      starjo33starjo33

      83




      83
























          1 Answer
          1






          active

          oldest

          votes


















          0














          If you try to do it in Word and clean a bit the code it generates, you get something like this:



                      ...
          <div class="Section1">

          This document contains
          <!--[if supportFields]>
          <span>
          <span style='mso-element:field-begin'></span>
          <span style='mso-spacerun:yes'> </span>
          NUMPAGES
          <span style='mso-spacerun:yes'>  </span>
          * MERGEFORMAT <span style='mso-element:field-separator'></span>
          </span>
          <![endif]-->
          <span style='mso-no-proof:yes'>X</span>
          <!--[if supportFields]>
          <span>
          <span style='mso-element:field-end'></span>
          </span>
          <![endif]--> pages.

          MORE CONTENT
          ...


          Please note that when you open the Word document, you have to "Update field" to see the correct number of pages. Otherwise it will display the "mso-no-proof" value (here "X").






          share|improve this answer
























          • Thank you for the guidance and example. Unfortunately what I am trying to acheive is to create all the content by using HTML forms and once complete, generate the completed word document. I was hoping that the PAGENUM generated in the footer could somehow be duplicated at the top of the document.

            – starjo33
            Nov 24 '18 at 1:44











          • Is there a way to update automatically as the document opens? - that would work a treat

            – starjo33
            Nov 24 '18 at 2:40











          • Well, you can select all with CTRL+A and press F9 to update all the fields of the document. Also, if you print out the document, fields will be automatically updated (you can verify with print preview). Does it fit with what you need? Or do you wish to keep your document as a Word file?

            – FloT
            Nov 24 '18 at 11:54











          • Thank you for the clarity, this is brilliant. Ideally I would of liked to see the number of pages when I opened the document, but this also updates when saving the document as a PDF. Flot, you're a legend - Thank you

            – starjo33
            Nov 24 '18 at 12:51











          • I'm glad that it helped :) One more thing: I don't know a way to auto-refresh via HTML only, but maybe you can update the tags of your post ? Maybe someone else will be able to do something like this in VBA...?

            – FloT
            Nov 24 '18 at 13:16












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53447505%2fhtml-to-ms-word-doc-with-total-number-of-pages%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          If you try to do it in Word and clean a bit the code it generates, you get something like this:



                      ...
          <div class="Section1">

          This document contains
          <!--[if supportFields]>
          <span>
          <span style='mso-element:field-begin'></span>
          <span style='mso-spacerun:yes'> </span>
          NUMPAGES
          <span style='mso-spacerun:yes'>  </span>
          * MERGEFORMAT <span style='mso-element:field-separator'></span>
          </span>
          <![endif]-->
          <span style='mso-no-proof:yes'>X</span>
          <!--[if supportFields]>
          <span>
          <span style='mso-element:field-end'></span>
          </span>
          <![endif]--> pages.

          MORE CONTENT
          ...


          Please note that when you open the Word document, you have to "Update field" to see the correct number of pages. Otherwise it will display the "mso-no-proof" value (here "X").






          share|improve this answer
























          • Thank you for the guidance and example. Unfortunately what I am trying to acheive is to create all the content by using HTML forms and once complete, generate the completed word document. I was hoping that the PAGENUM generated in the footer could somehow be duplicated at the top of the document.

            – starjo33
            Nov 24 '18 at 1:44











          • Is there a way to update automatically as the document opens? - that would work a treat

            – starjo33
            Nov 24 '18 at 2:40











          • Well, you can select all with CTRL+A and press F9 to update all the fields of the document. Also, if you print out the document, fields will be automatically updated (you can verify with print preview). Does it fit with what you need? Or do you wish to keep your document as a Word file?

            – FloT
            Nov 24 '18 at 11:54











          • Thank you for the clarity, this is brilliant. Ideally I would of liked to see the number of pages when I opened the document, but this also updates when saving the document as a PDF. Flot, you're a legend - Thank you

            – starjo33
            Nov 24 '18 at 12:51











          • I'm glad that it helped :) One more thing: I don't know a way to auto-refresh via HTML only, but maybe you can update the tags of your post ? Maybe someone else will be able to do something like this in VBA...?

            – FloT
            Nov 24 '18 at 13:16
















          0














          If you try to do it in Word and clean a bit the code it generates, you get something like this:



                      ...
          <div class="Section1">

          This document contains
          <!--[if supportFields]>
          <span>
          <span style='mso-element:field-begin'></span>
          <span style='mso-spacerun:yes'> </span>
          NUMPAGES
          <span style='mso-spacerun:yes'>  </span>
          * MERGEFORMAT <span style='mso-element:field-separator'></span>
          </span>
          <![endif]-->
          <span style='mso-no-proof:yes'>X</span>
          <!--[if supportFields]>
          <span>
          <span style='mso-element:field-end'></span>
          </span>
          <![endif]--> pages.

          MORE CONTENT
          ...


          Please note that when you open the Word document, you have to "Update field" to see the correct number of pages. Otherwise it will display the "mso-no-proof" value (here "X").






          share|improve this answer
























          • Thank you for the guidance and example. Unfortunately what I am trying to acheive is to create all the content by using HTML forms and once complete, generate the completed word document. I was hoping that the PAGENUM generated in the footer could somehow be duplicated at the top of the document.

            – starjo33
            Nov 24 '18 at 1:44











          • Is there a way to update automatically as the document opens? - that would work a treat

            – starjo33
            Nov 24 '18 at 2:40











          • Well, you can select all with CTRL+A and press F9 to update all the fields of the document. Also, if you print out the document, fields will be automatically updated (you can verify with print preview). Does it fit with what you need? Or do you wish to keep your document as a Word file?

            – FloT
            Nov 24 '18 at 11:54











          • Thank you for the clarity, this is brilliant. Ideally I would of liked to see the number of pages when I opened the document, but this also updates when saving the document as a PDF. Flot, you're a legend - Thank you

            – starjo33
            Nov 24 '18 at 12:51











          • I'm glad that it helped :) One more thing: I don't know a way to auto-refresh via HTML only, but maybe you can update the tags of your post ? Maybe someone else will be able to do something like this in VBA...?

            – FloT
            Nov 24 '18 at 13:16














          0












          0








          0







          If you try to do it in Word and clean a bit the code it generates, you get something like this:



                      ...
          <div class="Section1">

          This document contains
          <!--[if supportFields]>
          <span>
          <span style='mso-element:field-begin'></span>
          <span style='mso-spacerun:yes'> </span>
          NUMPAGES
          <span style='mso-spacerun:yes'>  </span>
          * MERGEFORMAT <span style='mso-element:field-separator'></span>
          </span>
          <![endif]-->
          <span style='mso-no-proof:yes'>X</span>
          <!--[if supportFields]>
          <span>
          <span style='mso-element:field-end'></span>
          </span>
          <![endif]--> pages.

          MORE CONTENT
          ...


          Please note that when you open the Word document, you have to "Update field" to see the correct number of pages. Otherwise it will display the "mso-no-proof" value (here "X").






          share|improve this answer













          If you try to do it in Word and clean a bit the code it generates, you get something like this:



                      ...
          <div class="Section1">

          This document contains
          <!--[if supportFields]>
          <span>
          <span style='mso-element:field-begin'></span>
          <span style='mso-spacerun:yes'> </span>
          NUMPAGES
          <span style='mso-spacerun:yes'>  </span>
          * MERGEFORMAT <span style='mso-element:field-separator'></span>
          </span>
          <![endif]-->
          <span style='mso-no-proof:yes'>X</span>
          <!--[if supportFields]>
          <span>
          <span style='mso-element:field-end'></span>
          </span>
          <![endif]--> pages.

          MORE CONTENT
          ...


          Please note that when you open the Word document, you have to "Update field" to see the correct number of pages. Otherwise it will display the "mso-no-proof" value (here "X").







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 23 '18 at 16:48









          FloTFloT

          269112




          269112













          • Thank you for the guidance and example. Unfortunately what I am trying to acheive is to create all the content by using HTML forms and once complete, generate the completed word document. I was hoping that the PAGENUM generated in the footer could somehow be duplicated at the top of the document.

            – starjo33
            Nov 24 '18 at 1:44











          • Is there a way to update automatically as the document opens? - that would work a treat

            – starjo33
            Nov 24 '18 at 2:40











          • Well, you can select all with CTRL+A and press F9 to update all the fields of the document. Also, if you print out the document, fields will be automatically updated (you can verify with print preview). Does it fit with what you need? Or do you wish to keep your document as a Word file?

            – FloT
            Nov 24 '18 at 11:54











          • Thank you for the clarity, this is brilliant. Ideally I would of liked to see the number of pages when I opened the document, but this also updates when saving the document as a PDF. Flot, you're a legend - Thank you

            – starjo33
            Nov 24 '18 at 12:51











          • I'm glad that it helped :) One more thing: I don't know a way to auto-refresh via HTML only, but maybe you can update the tags of your post ? Maybe someone else will be able to do something like this in VBA...?

            – FloT
            Nov 24 '18 at 13:16



















          • Thank you for the guidance and example. Unfortunately what I am trying to acheive is to create all the content by using HTML forms and once complete, generate the completed word document. I was hoping that the PAGENUM generated in the footer could somehow be duplicated at the top of the document.

            – starjo33
            Nov 24 '18 at 1:44











          • Is there a way to update automatically as the document opens? - that would work a treat

            – starjo33
            Nov 24 '18 at 2:40











          • Well, you can select all with CTRL+A and press F9 to update all the fields of the document. Also, if you print out the document, fields will be automatically updated (you can verify with print preview). Does it fit with what you need? Or do you wish to keep your document as a Word file?

            – FloT
            Nov 24 '18 at 11:54











          • Thank you for the clarity, this is brilliant. Ideally I would of liked to see the number of pages when I opened the document, but this also updates when saving the document as a PDF. Flot, you're a legend - Thank you

            – starjo33
            Nov 24 '18 at 12:51











          • I'm glad that it helped :) One more thing: I don't know a way to auto-refresh via HTML only, but maybe you can update the tags of your post ? Maybe someone else will be able to do something like this in VBA...?

            – FloT
            Nov 24 '18 at 13:16

















          Thank you for the guidance and example. Unfortunately what I am trying to acheive is to create all the content by using HTML forms and once complete, generate the completed word document. I was hoping that the PAGENUM generated in the footer could somehow be duplicated at the top of the document.

          – starjo33
          Nov 24 '18 at 1:44





          Thank you for the guidance and example. Unfortunately what I am trying to acheive is to create all the content by using HTML forms and once complete, generate the completed word document. I was hoping that the PAGENUM generated in the footer could somehow be duplicated at the top of the document.

          – starjo33
          Nov 24 '18 at 1:44













          Is there a way to update automatically as the document opens? - that would work a treat

          – starjo33
          Nov 24 '18 at 2:40





          Is there a way to update automatically as the document opens? - that would work a treat

          – starjo33
          Nov 24 '18 at 2:40













          Well, you can select all with CTRL+A and press F9 to update all the fields of the document. Also, if you print out the document, fields will be automatically updated (you can verify with print preview). Does it fit with what you need? Or do you wish to keep your document as a Word file?

          – FloT
          Nov 24 '18 at 11:54





          Well, you can select all with CTRL+A and press F9 to update all the fields of the document. Also, if you print out the document, fields will be automatically updated (you can verify with print preview). Does it fit with what you need? Or do you wish to keep your document as a Word file?

          – FloT
          Nov 24 '18 at 11:54













          Thank you for the clarity, this is brilliant. Ideally I would of liked to see the number of pages when I opened the document, but this also updates when saving the document as a PDF. Flot, you're a legend - Thank you

          – starjo33
          Nov 24 '18 at 12:51





          Thank you for the clarity, this is brilliant. Ideally I would of liked to see the number of pages when I opened the document, but this also updates when saving the document as a PDF. Flot, you're a legend - Thank you

          – starjo33
          Nov 24 '18 at 12:51













          I'm glad that it helped :) One more thing: I don't know a way to auto-refresh via HTML only, but maybe you can update the tags of your post ? Maybe someone else will be able to do something like this in VBA...?

          – FloT
          Nov 24 '18 at 13:16





          I'm glad that it helped :) One more thing: I don't know a way to auto-refresh via HTML only, but maybe you can update the tags of your post ? Maybe someone else will be able to do something like this in VBA...?

          – FloT
          Nov 24 '18 at 13:16




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53447505%2fhtml-to-ms-word-doc-with-total-number-of-pages%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()