Created
June 27, 2009 22:31
-
-
Save necronet/137142 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean export(){ | |
try | |
{ | |
//Nuestro flujo de salida para apuntar a donde vamos a escribir | |
DataOutputStream out=new DataOutputStream(new FileOutputStream(file)); | |
//Representa nuestro archivo en excel y necesita un OutputStream para saber donde va locoar los datos | |
WritableWorkbook w = Workbook.createWorkbook(out); | |
//Como excel tiene muchas hojas esta crea o toma la hoja | |
//Coloca el nombre del "tab" y el indice del tab | |
WritableSheet s = w.createSheet(nombreTab, 0); | |
//Cerramos el WritableWorkbook y DataOutputStream | |
w.close(); | |
out.close(); | |
//si todo sale bien salimos de aqui con un true :D | |
return true; | |
}catch(IOException ex){ex.printStackTrace();} | |
catch(WriteException ex){ex.printStackTrace();} | |
//Si llegamos hasta aqui algo salio mal | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment