DataExporter - Customized Documents

DataExporter provides easy customization options for the exported document using pre and post processors or ExcelOptions and PDFOptions objects.

Documentation
IdYearBrandColor
c143ab6f1971HondaYellow
2dc668e01969VolvoSilver
f0b69f971960FordGreen
2ef3c9f42004MercedesOrange
907616b71974VolkswagenBrown
e4eebac61969JaguarGreen
c68130d71995MercedesBlack
53f40c881970FordRed
91b6eec21968JaguarBrown
aa9156072003BMWRed
IdYearBrandColor
e61a372a1993MercedesSilver
4d52b10d1971RenaultRed
420960c41971FordRed
f973ca681972AudiBlack
31fe97d01976JaguarWhite
7ebb79ec1994BMWBrown
081f7a142006AudiBlack
d0632f071965BMWRed
bb8d07e12002MercedesBrown
46e3d0f42006FiatRed
<h:form>
    <p:dataTable id="tbl" var="car" value="#{customizedDocumentsView.cars}" 
                 paginator="true" rows="10">
        <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>

    <h:commandLink id="excel">
        <p:graphicImage name="/demo/images/excel.png" />
        <p:dataExporter type="xls" target="tbl" fileName="cars" postProcessor="#{customizedDocumentsView.postProcessXLS}" />
    </h:commandLink>

    <h:commandLink id="pdf">
        <p:graphicImage name="/demo/images/pdf.png" />
        <p:dataExporter type="pdf" target="tbl" fileName="cars" preProcessor="#{customizedDocumentsView.preProcessPDF}" />
    </h:commandLink>

    <p:dataTable id="tbl2" var="car" value="#{customizedDocumentsView.cars2}" 
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {Exporters}"
                 paginator="true" rows="10" style="margin-top: 25px;">

        <f:facet name="{Exporters}">
            <div style="float:right">
                <h:commandLink>
                    <p:graphicImage name="/demo/images/excel.png" width="24"/>
                    <p:dataExporter type="xls" target="tbl2" fileName="cars" options="#{customizedDocumentsView.excelOpt}" />
                </h:commandLink>

                <h:commandLink>
                    <p:graphicImage name="/demo/images/pdf.png" width="24"/>
                    <p:dataExporter type="pdf" target="tbl2" fileName="cars" options="#{customizedDocumentsView.pdfOpt}" />
                </h:commandLink>
            </div>
        </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>
</h:form>

FREE THEMES

Built-in component themes created by the PrimeFaces Theme Designer.

nova-light Nova-Light
nova-dark Nova-Dark
nova-colored Nova-Colored
luna-blue Luna-Blue
luna-amber Luna-Amber
luna-green Luna-Green
luna-pink Luna-Pink
omega Omega

PREMIUM TEMPLATES

Create awesome applications in no time using the premium templates and impress your users.