Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Apache poi

814 visualizaciones

Publicado el

Short presentation about Apache POI basics for English classes (SoftServe University)

Publicado en: Educación, Tecnología
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

Apache poi

  1. 1. Apache POI the Java API for Microsoft Documents
  2. 2. AGENDA • What is Apache POI? • How to use Apache POI? • Demo 
  3. 3. WHAT APACHE POI STANDS FOR? Poor Obfuscation Implementation  Provides pure Java libraries for reading and writing files in Microsoft Office formats
  4. 4. APACHE POI CAPABILITIES Component APIs • Excel (SS=HSSF+XSSF) • Word (HWPF+XWPF) • PowerPoint (HSLF+XSLF) • Outlook (HSMF) • Visio (HDGF) • Publisher (HPBF)
  5. 5. WHAT IS APACHE POI • Java library, part of Jakarta Project • Open Source • Supports ©Microsoft ™® proprietary document formats
  6. 6. WHERE IT IS? • Download: http://poi.apache.org/download.html • Maven: <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.9</version> </dependency>
  7. 7. HOW TO USE IT? //Create workbook XSSFWorkbook workbook = new XSSFWorkbook(); //Create a blank sheet XSSFSheet sheet = workbook.createSheet("Employee Data"); //Prepare data to be written (Object[]) Map<String, Object[]> data = new TreeMap<String, Object[]>(); data.put("1", new Object[] {"ID", "NAME", "LASTNAME"}); data.put("2", new Object[] {1, “Volodymyr", “Ostapiv"}); Let’s write some data into excel file…
  8. 8. HOW TO USE IT? //Don’t forget to write the workbook FileOutputStream out = new FileOutputStream( new File(“test.xlsx")); workbook.write(out); //Iterate over data and write to sheet Set<String> keyset = data.keySet(); int rownum = 0; for (String key : keyset) { Row row = sheet.createRow(rownum++); Object [] objArr = data.get(key); int cellnum = 0; for (Object obj : objArr) { Cell cell = row.createCell(cellnum++); cell.setCellValue((String)obj); } }
  9. 9. HOW TO USE APACHE POI • Downloadable JAR file • Maven/Graddle support • Usage example
  10. 10. SO BORING…
  11. 11. HOW ABOUT HAVING FUN?
  12. 12. WHERE ENGINEERING BECOMES ART http://poi-painter.akceptor-kindle.cloudbees.net/
  13. 13. WE DID IT! • Apache POI is… • Usage examples • Artistic demo 
  14. 14. FINALLY Apache POI: use it not only for work, but as well for art!
  15. 15. My article about Apache POI: http://habrahabr.ru/post/180489/ Sources: https://github.com/Akceptor/POIPainter
  16. 16. My article about Apache POI: http://habrahabr.ru/post/180489/ Sources: https://github.com/Akceptor/POIPainter

×