Is there a way to customize an exported file ?

UI Components for JSF
Post Reply
Will
Posts: 22
Joined: 10 Apr 2009, 09:48

15 Jun 2009, 14:22

Hi,
I would like to know if there is a way to add some stuffs in a generated exported file like title, subtitle, caption...
I use this code to generate an export file :

Code: Select all

<html:commandButton value="Exporter en CSV">
		<opt:exportActionListener type="csv" target="tabPeriode" fileName="data"/>
</html:commandButton>
</p>
<p style="text-align:center">
<html:commandButton value="Exporter en PDF">
		<opt:exportActionListener type="pdf" target="tabPeriode" fileName="data"/>
</html:commandButton>
</p>
<p style="text-align:center">
<html:commandButton value="Exporter en XML">
		<opt:exportActionListener type="xml" target="tabPeriode" fileName="data"/>
</html:commandButton>
</p>
thanks

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

15 Jun 2009, 15:32

Currently no but this actually sounds like a good candidate for a new feature. Something like postProcessor should be really helpful so users can hook in some custom code for customization. I think of something like this. What do you think?

Code: Select all

public void postProcessPDF(Document document) {
//custom code to modify with itext
}
And then

Code: Select all

<html:commandButton value="Exporter en PDF">
      <opt:exportActionListener type="pdf" target="tabPeriode" fileName="data" postProcessor="#{bean.postProcessPDF}"/>
</html:commandButton>

Will
Posts: 22
Joined: 10 Apr 2009, 09:48

15 Jun 2009, 15:45

I think it could be a nice idea.
How might i do this ? i've few time to take a look (entreprise project)

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

15 Jun 2009, 15:56

I'll try to add it when I find some open space. But as a hack if you need it asap you can change our PDFExporter and build the project. Related class is;

http://code.google.com/p/primefaces/sou ... orter.java

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

06 Jul 2009, 11:20

Will, fyi preProcessor and postProcessors are added to dataExport to allow customization before and after exporting. See the online demo to see it in action.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 54 guests