Solved!!!!
With this p:dataExporter does not recognize p:cellEditor
My solution it's too similar, only changes a function "exportValue" and class of extends.
Xhtml:
<h:commandLink value="Excel" action="#{myBean.exportExcel(table, 'filename')}" />
<p:dataTable id="tablaDatos" binding="#{table}" etc...>
<!-- data -->
</p:dataTable>
Method on bean:
public void exportExcel(DataTable table, String filename) throws IOException {
FacesContext context = FacesContext.getCurrentInstance();
MyExporterXls exporter = new MyExporterXls();
exporter.export(context, table, filename, false, false, "UTF-8", null, null);
context.responseComplete();
}
My solution
public class MyExporterXls extends ExcelExporter {
@Override
protected String exportValue(FacesContext fc, UIComponent uic) {
String valor = "";
System.out.println("uic = " + uic);
if (uic instanceof HtmlOutputText) {
valor = parseValorCelda(((HtmlOutputText) uic).getValue());
}
return valor;
}
private String parseValorCelda(Object valor) {
String retorno = "";
//Cadenas
if (valor instanceof String) {
retorno = (String) valor;
}
//Numeros ENTEROS
if (valor instanceof Short) {
retorno = ((Short) valor).toString();
}
if (valor instanceof Integer) {
retorno = ((Integer) valor).toString();
}
if (valor instanceof BigInteger) {
retorno = ((BigInteger) valor).toString();
}
if (valor instanceof Long) {
retorno = ((Long) valor).toString();
}
//Numeros decimales
if (valor instanceof Double) {
retorno = ((Double) valor).toString();
}
if (valor instanceof Float) {
retorno = ((Float) valor).toString();
}
if (valor instanceof BigDecimal) {
retorno = ((BigDecimal) valor).toString();
}
return retorno;
}
}