DataExporter - Basic EXCEL, PDF, CSV and XML are the supported formats.
IdYearBrandColor
a04f34371982MercedesBlack
c2e64c311987MercedesMaroon
299f1bd01993RenaultBlack
787036bc1989JaguarBlue
536b15741974RenaultMaroon
65a603561986HondaBlack
1d0e070c2009VolkswagenYellow
e6b19a241962AudiYellow
3d2c77511988MercedesYellow
24e3f5f11976RenaultSilver

Export Page Data Only

<h:form>
    <p:dataTable id="tbl" var="car" value="#{dataExporterView.cars}" 
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {Exporters}"
                 paginator="true" rows="10" style="margin-bottom:20px">

        <f:facet name="{Exporters}">
            <h:commandLink>
                <p:graphicImage name="/demo/images/excel.png" width="24"/>
                <p:dataExporter type="xls" target="tbl" fileName="cars" />
            </h:commandLink>

            <h:commandLink>
                <p:graphicImage name="/demo/images/pdf.png" width="24"/>
                <p:dataExporter type="pdf" target="tbl" fileName="cars"/>
            </h:commandLink>

            <h:commandLink>
                <p:graphicImage name="/demo/images/csv.png" width="24"/>
                <p:dataExporter type="csv" target="tbl" fileName="cars" />
            </h:commandLink>

            <h:commandLink>
                <p:graphicImage name="/demo/images/xml.png" width="24"/>
                <p:dataExporter type="xml" target="tbl" fileName="cars" />
            </h:commandLink>
        </f:facet>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Id" />
            </f:facet>
            <h:outputText value="#{car.id}" />
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Year"/>
            </f:facet>
            <h:outputText value="#{car.year}" />
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Brand" />
            </f:facet>
            <h:outputText value="#{car.brand}" />
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Color" />
            </f:facet>
            <h:outputText value="#{car.color}" />
        </p:column>
    </p:dataTable>

    <h3>Export Page Data Only</h3>
    <h:commandLink>
        <p:graphicImage name="/demo/images/excel.png" />
        <p:dataExporter type="xls" target="tbl" fileName="cars" pageOnly="true"/>
    </h:commandLink>

    <h:commandLink>
        <p:graphicImage name="/demo/images/pdf.png" />
        <p:dataExporter type="pdf" target="tbl" fileName="cars" pageOnly="true" />
    </h:commandLink>

    <h:commandLink>
        <p:graphicImage name="/demo/images/csv.png" />
        <p:dataExporter type="csv" target="tbl" fileName="cars" pageOnly="true" />
    </h:commandLink>

    <h:commandLink>
        <p:graphicImage name="/demo/images/xml.png" />
        <p:dataExporter type="xml" target="tbl" fileName="cars" pageOnly="true" />
    </h:commandLink>
</h:form>
                
PrimeTek, Copyright © 2017
All rights reserved.
Running PrimeFaces-6.2-SNAPSHOT on Mojarra-2.3.2.