Skip to content

Instantly share code, notes, and snippets.

@necronet
Created June 27, 2009 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save necronet/137142 to your computer and use it in GitHub Desktop.
Save necronet/137142 to your computer and use it in GitHub Desktop.
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