none
Adding multiple footer values(left ,center and right) in correct position using style in word document RRS feed

  • Question

  • Hi,

    I am using the below code to generate the word document dynamically.when i am inserting multiple footer valuesn the position, for example left,center right. footer 's are not positioning properly.i am facing an alighnment and wrapping issue.can anyone provide how can i rectify this using proper styles.

    StringBuilder sbTop = new System.Text.StringBuilder();
    sbTop.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></title>

    <!--[if gte mso 9]>
    <xml>
    <w:WordDocument>
    <w:View>Print</w:View>
    <w:Zoom>90</w:Zoom>
    <w:DoNotOptimizeForBrowser/>
    </w:WordDocument>
    </xml>
    <![endif]-->


    <style>
    p.MsoFooter, li.MsoFooter, div.MsoFooter
    {
    margin:0in;
    margin-bottom:.0001pt;
    mso-pagination:widow-orphan;tab-stops:left 3.0in right 6.0in;
    tab-stops:center 3.0in right 6.0in;
    tab-stops:right 3.0in right 6.0in;
    font-size:12.0pt;
    }
    <style>

    <!-- /* Style Definitions */

    @page Section1
    {
    size:8.5in 11.0in;
    margin:1.0in 1.25in 1.0in 1.25in ;
    mso-header-margin:.5in;
    mso-header:h1;
    mso-footer: f1;
    mso-footer-margin:.5in;
    }


    div.Section1
    {
    page:Section1;
    }

    table#hrdftrtbl
    {
    margin:0in 0in 0in 9in;
    }
    -->
    </style></head>

    <body lang=EN-US style='tab-interval:.5in'>
    <div class=Section1>
    <h1>Time and tide wait for none</h1>
    The quick brown fox jumps over the lazy dog
    ...
    ...


    <table id='hrdftrtbl' border='1' cellspacing='0' cellpadding='0'>
    <tr><td>
    <div style='mso-element:header' id=h1 >
    <p class=MsoHeader style='text-align:center'>Confidential</p>
    </div>
    </td>
    <td>
    <div style='mso-element:footer' id=f1>
    <p class=MsoFooter>Draft
    <span style=mso-tab-count:2'></span><span style='mso-field-code:"" PAGE ""'></span></p>
    <p class=MsoFooter>Draft
    <span style=mso-tab-count:1'></span><span style='mso-field-code:"" TIME ""'></span>
    </p>
    <p class=MsoFooter>Draft
    <span style=mso-tab-count:0'></span><span style='mso-field-code:""DATE""'></span>
    </p>

    </div>
    /td></tr>
    </table>
    </body></html>


    can anyone provide solution to this.

    Regards

    R.Rajesh


    Saturday, January 21, 2012 5:18 PM

All replies