Guest User

Untitled

a guest
Jan 19th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. package Excel;
  2. import java.io.File;
  3. import java.io.FileNotFoundException;
  4. import java.io.FileOutputStream;
  5. import java.io.IOException;
  6. import java.util.logging.Level;
  7. import java.util.logging.Logger;
  8. import org.apache.poi.ss.usermodel.CellStyle;
  9. import org.apache.poi.ss.usermodel.FillPatternType;
  10. import org.apache.poi.ss.usermodel.IndexedColors;
  11. import org.apache.poi.ss.usermodel.Workbook;
  12. import org.apache.poi.xssf.usermodel.XSSFCell;
  13. import org.apache.poi.xssf.usermodel.XSSFRow;
  14. import org.apache.poi.xssf.usermodel.XSSFSheet;
  15. import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  16.  
  17. public class Antes_Del_Traslado_Excel {
  18.  
  19. private static final Logger LOGGER = Logger.getLogger("mx.com.hash.newexcel.Antes_Del_Traslado_Excel");
  20.  
  21. public Antes_Del_Traslado_Excel() {
  22.  
  23. try {
  24.  
  25. File Excel = new File("Traslados.xlsx");
  26.  
  27. XSSFWorkbook Libro=XSSFWorkbook.getWorkbook(Excel);
  28.  
  29. XSSFSheet Hoja1= Libro.getSheetAt(0);
  30.  
  31. XSSFRow Fila=Hoja1.createRow(0);
  32.  
  33. XSSFCell Celda=Fila.createCell(2);
  34.  
  35. Celda.setCellValue("Prueba");
  36.  
  37. FileOutputStream Salid = new FileOutputStream(Excel);
  38.  
  39. Libro.write(Salid);
  40.  
  41. Salid.close();
  42.  
  43. }catch (FileNotFoundException ex) {
  44.  
  45. LOGGER.log(Level.SEVERE, "Archivo no localizable en sistema de archivos");
  46.  
  47. }catch (IOException ex) {
  48.  
  49. LOGGER.log(Level.SEVERE, "Error de entrada/salida");
  50.  
  51. }
  52.  
  53. }
  54.  
  55. }
Add Comment
Please, Sign In to add comment