/** @throws IOException */ public void exportXLS() throws IOException { DataTable tabla = (DataTable) FacesContext.getCurrentInstance() .getViewRoot() .findComponent("formExportar:datosEmpresasExportar"); FacesContext context = FacesContext.getCurrentInstance(); Exporter exporter = new ExportarXLS(); exporter.export(context, tabla, "CentroCostos", false, false, "UTF-8", null, null); context.responseComplete(); index = -1; }
public void wordExport() { String encodingType = "UTF-8"; FacesContext facesContext = FacesContext.getCurrentInstance(); try { String outputFileName = getModelName().toLowerCase(Locale.ENGLISH) + "Listesi"; Exporter exporter = new WordExporter(); int[] excludedColumns = new int[0]; exporter.export( facesContext, getTable(), outputFileName, false, false, excludedColumns, encodingType, null, null); facesContext.responseComplete(); } catch (IOException e) { throw new FacesException(e); } }