Reputation: 111
I'm generating a .doc with html and I would like the footer to only appear from the second page onwards, does anyone know how to do this? I saw some answers here about this problem but I still don't understand how it should look in the code.
<head>
<style type="text/css" media="print">
@page Section1 {
size:8.3in 11.7in;
mso-footer:f1;
mso-header:h1;
margin:0.0in 0.6in 0.0in 0.6in;
mso-header-margin:0.0in;
mso-footer-margin:0.0in;
}
div.Section1{
page:Section1;
}
p.MsoFooter, li.MsoFooter, div.MsoFooter {
mso-pagination:widow-orphan;
}
<body>
<!-- Content -->
<div class="Section1">
<!-- Cover Page 1 -->
<div class="coverP">
Cover page text goes here
</div>
<br clear="all" style="page-break-before:always" />
<!-- Page 2 Starts -->
<div>
Page 2 goes here with footer (pg#2 and logo)
</div>
<br clear="all" style="page-break-before:always" />
<!-- Page 3 Starts -->
<div>
page 3 go here with footer (pg#2 and logo)
</div>
<!---------- HEADER AND FOOTER SECTIONS --------------->
<br clear="all" style="page-break-before:always" />
<div style="mso-element:header" id="h1">
<table>...</table>
</div>
<div style="mso-element:footer" id="f1" >
<table>...</table>
</div>
</body>
</html>```
told to configure ```mso-title-page: yes; ``` but where? And they also said to replace ```mso-``` with ``` mso-first-``` but again where and how? if anyone knows how to give me a light, I would appreciate it, or even send me the link to the documentation...
Upvotes: 0
Views: 950
Reputation: 111
I got it. I'm developing using a visualforce page but the code can be adapted to HTML or etc. Set mso-title-page:yes; The leap of the cat is to define in @page 2 footers one for the first page and another for the other pages, the same goes for the header, then just create the elements (footer and header) with IDs referring to the footer/heade of the first page or the others, in my case as I wanted the first page to have a header but not a footer, I didn't create a footer for the first page. It gets clearer in the code.
<head>
<style type="text/css" media="print">
@page Section1 {
size:8.3in 11.7in;
mso-title-page:yes;<!--Aqui dizemos que esse documento vai possuir uma página título--->
mso-footer:f1;<!--Definimos o ID para o footer de todas as páginas, execeto a primeira-->
mso-header:h1;<!--Definimos o ID para o header de todas as páginas, execeto a primeira-->
mso-first-header: fh1;<!--Definimos o ID para o header da primeira página-->
mso-first-footer: ff1;<!--Definimos o ID para o footer da primeira página-->
margin:0.0in 0.6in 0.0in 0.6in;
mso-header-margin:0.0in;
mso-footer-margin:0.0in;
}
div.Section1{
page:Section1;
}
.
.
.
Códigos
.
.
.
<!---------- HEADER AND FOOTER SECTIONS --------------->
<br clear="all" style="page-break-before:always" />
<div style="mso-element:header" id="h1">
<!-- Código para a construção do header padrão -->
</div>
<br clear="all" style="page-break-before:always" />
<div style="mso-element:footer" id="f1">
<!-- Código para a construção do footer padrão -->
</div>
<br clear="all" style="page-break-before:always" />
<div style="mso-element:header" id="fh1">
<!-- Código para a construção do header exclusivo para a 1° página -->
</div>
<!--Como eu não queria footer na primeira página, foi só não construir um footer que apontasse para o: style="mso-element:footer" id="ff1" -->
Useful links https://www.py4u.net/discuss/987057 http://techsynapse.blogspot.com/2007/03/generating-word-document-dynamically.html http://www.pbdr.com/ostips/wordfoot.htm
Upvotes: 1