+ Start a Discussion
l.trincil.trinci 

Header & Footer in doc

The only way i know to "render" the visualforce page as a doc document is:

contentType="application/msword.doc"

 

My question is: Can i show the header and the footer in the doc document resultant?

 

in my tests do not appear, when it is printed to the screen with no problems with "render as pdf"

 

 

apex:

<body>

 

<!-- All Pages Header -->
<c:PDFHeaderFooter type="header" position="center">
<div style="padding: 0px; background-color: #FFFFFF"><img src="{!URLFOR($Resource.Header)}"/></div></c:PDFHeaderFooter>


<!-- All Pages Footer -->
<c:PDFHeaderFooter type="footer" position="left">
<div style="padding: 10px; background-color: #FFFFFF"><img src="{!URLFOR($Resource.Footer)}"/></div></c:PDFHeaderFooter>
<c:PDFHeaderFooter type="footer" position="right" showPageNumbers="true"/>

<!-- Content -->
<h1 style="padding-top: 0px; background-color: #FFFFFF;"><div id="main" class="clearfix">
<div align="left" style="margin-top: 0px;">
<div><h3>Informazioni personali</h3></div>
<hr>
</hr>

 

visualforce component:

<apex:component >
    <!-- Component Attributes -->
    <apex:attribute type="string" name="type"
        description="Determines if the component renders as a header or footer" />
    <apex:attribute type="string" name="position"
        description="Determines if component should render the text on the left, center, or right" />
    <apex:attribute type="boolean" name="showPageNumbers"
        description="Determines if the header/footer information displays the page number information." />
        
    <!-- Component Variables -->    
    <apex:variable var="styleClass" value="{!LOWER(type)}_{!LOWER(position)}"/>
    
    <!-- Component Body -->
    <apex:outputPanel id="panelHeaderFooter" 
        styleClass="{!styleClass}"
        layout="block">
        
       
        
        <apex:componentBody />
    </apex:outputPanel>
</apex:component>

css:

@page { 
	size: letter portrait;
	
	margin-top: 180px;
	margin-bottom: 100px;
	
	@top-left {
		content: element(header_left);
	}
	
	@top-center {
		content: element(header_center);
	}
	
	@top-right {
		content: element(header_right);
	}
	
	@bottom-left {
		content: element(footer_left);
	}
	
	@bottom-center {
		content: element(footer_center);
	}
	
	@bottom-right {
		content: element(footer_right);
	}
}

.header_left {
	text-align: left;
    position: running(header_left);
}

.header_center{
	text-align: center;
	position: running(header_center);
}

.header_right {
	text-align: right;
	position: running(header_right);
}

.footer_left {
	text-align: left;
	position: running(footer_left);
}

.footer_center {
	text-align: center;
	position: running(footer_center);
}

.footer_right {
	text-align: right;
	position: running(footer_right);
}

.pageNumber:before {
	content: counter(page); 
}

.pageCount:before {
	content: counter(pages);  
}

 

Thanks