jsf - export text then image in excel or pdf with dataexporter -
i using primefaces 3.4.2 jar.i have 1 datatable image in 1 column , want export given text rather exported value graphic image "org.primefaces.component.graphicimage.graphicimage@578a5496" in excel.
<p:datatable id="data" var="data" value="#{bean.list}"> <p:column style="width:3%"> <f:facet name="header"> <h:outputtext value="value"></h:outputtext> </f:facet> <h:graphicimage style="border:0;" name="image1.png" library ="images" rendered="#{data.image eq 'image1'}"/> <h:graphicimage style="border:0;" name="image2.png" library ="images" rendered="#{data.image eq 'image2'"/> </p:column> </p:datatable> <h:commandlink id="exceldataexporterlink"> <h:graphicimage id="searchexce1" name="excel1.png" library="images"></h:graphicimage> <p:dataexporter type="xls" target="data" filename="data" pageonly="true" /> </h:commandlink>
i want export text image1/image2
corresponding value column. text org.primefaces.component.graphicimage.graphicimage@578a5496
exported in excel or pdf.
one way extend excelexporter
(i guess similar thing can done pdfexporter too), this:
notice value taken alt
attribute,
public class extendedexcelexporter extends excelexporter { @override protected string exportvalue(facescontext context, uicomponent component) { if (component instanceof htmlgraphicimage) { return (string) component.getattributes().get("alt"); } else { return super.exportvalue(context, component); } } }
the above taken issue 4013: support celleditor , images in exporter
know feature released in primefaces elite 4.0.9 , 3.5.25
Comments
Post a Comment