Exemplo n.º 1
0
 private Workbook readWorkbookFrom(Response whenPostingToReportUrl) {
   try {
     return WorkbookFactory.create(new ByteArrayInputStream(whenPostingToReportUrl.asByteArray()));
   } catch (IOException | InvalidFormatException e) {
     e.printStackTrace();
     throw new AssertionFailedError(e.getMessage());
   }
 }
Exemplo n.º 2
0
 /**
  * Create a simple Excel file reader.
  *
  * @param filename name of the excel workbook
  * @param numField number of cells per row to read
  */
 public ExcelReader(String filename, int numField) {
   this.numField = numField;
   sheet = null;
   msg = "";
   try {
     InputStream inp = new FileInputStream(filename);
     Workbook wb = WorkbookFactory.create(inp);
     sheet = wb.getSheetAt(0);
   } catch (IOException | InvalidFormatException e) {
     msg = e.getMessage();
   }
 }