Need a help immediately. I've been breaking my header over this for few days.. So a second or third eye would dfntly help. Here is the situation. I have a requirement, where an HTML content has to be generated using ASP.NET and the same to be rendered to
browser as word. I achieve this by setting Content-Type as application/msword. Everything works fine .. Now here is a requirement where I get in to trouble.
I need to provide page numbers as headers document. For ex. Page 1 of 10, Page 2 of 10 etc.. Here is the HTML snippet I tried to get in to the HTML to get this working..
Refer the header section.. Here is where I insert HTML to set page numbers in the header in the format of Page 1 of 10. Now this works fine and displays page number in all the pages.
But the issue is, the static part of this message i.e "Page of" is displayed as text content in the last page of document. Can anyone let me know what the tag or stype or any stuff which I can do to get rid of this content from my last page in the document.
I;ve done some reseach and applied several of the MSO styles (like MsoPageNumber class etc) and nothing works..
mrjonie
0 Points
1 Post
HTML Rendered as Word : Issue with Page Number in Last page content
May 10, 2012 08:31 PM|LINK
Hi,
Need a help immediately. I've been breaking my header over this for few days.. So a second or third eye would dfntly help. Here is the situation. I have a requirement, where an HTML content has to be generated using ASP.NET and the same to be rendered to browser as word. I achieve this by setting Content-Type as application/msword. Everything works fine .. Now here is a requirement where I get in to trouble.
I need to provide page numbers as headers document. For ex. Page 1 of 10, Page 2 of 10 etc.. Here is the HTML snippet I tried to get in to the HTML to get this working..
Setting for print layout
<!--[if gte mso 9]>
<xml>
<w:WordDocument>
<w:View>Print</w:View>
<w:Zoom>90</w:Zoom>
<w:DoNotOptimizeForBrowser/>
</w:WordDocument>
</xml>
<![endif]-->)
Setting Styles
<style>
<!-- /* Style Definitions */
@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;}
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:12.0pt;
font-family:\Times New Roman\;}
-->
</style></head>)
Header Section
<div style='mso-element:header' id=h1>
<p><span style='mso-tab-count:1'></span>
<span> Page </span>
<span style='mso-field-code:PAGE'></span>
<span> of </span>
<span style='mso-field-code:NUMPAGES'></span>
</p>
</div>
Refer the header section.. Here is where I insert HTML to set page numbers in the header in the format of Page 1 of 10. Now this works fine and displays page number in all the pages.
But the issue is, the static part of this message i.e "Page of" is displayed as text content in the last page of document. Can anyone let me know what the tag or stype or any stuff which I can do to get rid of this content from my last page in the document.
I;ve done some reseach and applied several of the MSO styles (like MsoPageNumber class etc) and nothing works..
Any help is appreciated.