• Settings
    • Locale
    • Change the locale of the datepicker, schedule and client side validation messages.

      Language
      English
      English
      English
      French
      German
      German
      German
      Italian
      Korean
      Spanish
      Catalan
      Dutch
      Portuguese
      Portuguese
      Arabic
      Arabic
      Bulgarian
      Bangla
      Bosnian
      Czech
      Greek
      Estonian
      Persian
      Finnish
      Danish
      Hindi
      Indonesian
      Icelandic
      Croatian
      Japanese
      Hungarian
      Hebrew
      Georgian
      Central Kurdish
      Khmer
      Kyrgyz
      Kazakh
      Lithuanian
      Latvian
      Malay
      Norwegian
      Polish
      Romanian
      Russian
      Slovak
      Slovenian
      Serbian
      Serbian
      Swedish
      Thai
      Turkish
      Ukrainian
      Uzbek
      Vietnamese
      Chinese
      Chinese
  • Resources

DataExporter Customized Documents

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

DataExporter Tag Documentation

DataExporter is handy for exporting data listed using a PrimeFaces Datatable to various formats such as excel, pdf, csv and xml.

NameTypeRequiredDefaultDescription
target String true Search expression to resolve one or multiple target components.
type String true Export type: "xls", "xlsx", "xlsxstream", "pdf", "csv", "xml".
fileName String true The target component id. Filename of the generated export file
pageOnly Boolean false Exports only current page instead of whole dataset.
selectionOnly Boolean false When enabled, only selection would be exported.
visibleOnly Boolean false false When enabled, only visible data would be exported.
exportHeader Boolean false true When enabled, the header will be exported.
exportFooter Boolean false true When enabled, the footer will be exported..
preProcessor MethodExpression false PreProcessor for the exported document.
postProcessor MethodExpression false PostProcessor for the exported document.
encoding String false Character encoding to use.
options ExporterOptions false Options object to customize document.
onTableRender MethodExpression false OnTableRender to be used to set the options of exported table.
onRowExport MethodExpression false Row processor for the exported document.
bufferSize Integer false Control how many items are fetched at a time when DataTable#lazy is enabled. Retrieve the entire underlying dataset in smaller, manageable chunks rather than all at once.
Loading...
Tag DocumentationNew DocumentationNew Documentation Basic Lazy Exclude Customized TreeTable
Processors
CodeNameCategoryQuantity
fldsmn31bGrey T-ShirtClothing0
mbvjkgip5Galaxy EarringsAccessories23
nvklal433Black WatchAccessories61
acvx872gcYellow EarbudsElectronics35
09zx9c0zcPainted Phone CaseAccessories41
vb34btbg5Light Green T-ShirtClothing34
zz21cz3c1Blue BandFitness2
mbvjkgip5Galaxy EarringsAccessories23
2c42cb5cbPurple Gemstone NecklaceAccessories62
acvx872gcYellow EarbudsElectronics35
Options
NameCategoryQuantity
Galaxy EarringsAccessories23
BraceletAccessories73
SneakersClothing52
Brown PurseAccessories0
Light Green T-ShirtClothing34
ShoesClothing0
Yoga SetFitness25
Black WatchAccessories61
Brown PurseAccessories0
Black WatchAccessories61

Usage


<div class="card">
    <h:form>
        <h5>Processors</h5>
        <p:commandButton value="XLS" styleClass="mr-2 mb-2">
            <p:dataExporter type="xlsxstream" target="tbl" fileName="products"
                            onRowExport="#{customizedDocumentsView.onRowExportXLS}"/>
        </p:commandButton>

        <p:commandButton value="PDF" styleClass="mr-2 mb-2">
            <p:dataExporter type="pdf" target="tbl" fileName="products"
                            preProcessor="#{customizedDocumentsView.preProcessPDF}"/>
        </p:commandButton>

        <p:dataTable id="tbl" var="product" value="#{customizedDocumentsView.products}"
                     paginator="true" rows="10" styleClass="mt-2">
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Code"/>
                </f:facet>
                <h:outputText value="#{product.code}"/>
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Name"/>
                </f:facet>
                <h:outputText value="#{product.name}"/>
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Category"/>
                </f:facet>
                <h:outputText value="#{product.category}"/>
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Quantity"/>
                </f:facet>
                <h:outputText value="#{product.quantity}"/>
            </p:column>
        </p:dataTable>

        <h5>Options</h5>

        <p:commandButton value="XLS" styleClass="mr-2 mb-2">
            <p:dataExporter type="xlsxstream" target="tbl2" fileName="products"
                            options="#{customizedDocumentsView.excelOpt}"/>
        </p:commandButton>

        <p:commandButton value="PDF" styleClass="mr-2 mb-2">
            <p:dataExporter type="pdf" target="tbl2" fileName="products"
                            options="#{customizedDocumentsView.pdfOpt}"/>
        </p:commandButton>

        <p:dataTable id="tbl2" var="product" value="#{customizedDocumentsView.products2}"
                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
                     paginator="true" rows="10" styleClass="mt-2">
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Name"/>
                </f:facet>
                <h:outputText value="#{product.name}"/>
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Category"/>
                </f:facet>
                <h:outputText value="#{product.category}"/>
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Quantity"/>
                </f:facet>
                <h:outputText value="#{product.quantity}"/>
            </p:column>
        </p:dataTable>
    </h:form>
</div>