Package jxl

Examples of jxl.Sheet


            return null;
        }

        Workbook workbook = Workbook.getWorkbook(file);

        Sheet sheet = workbook.getSheets()[0];

        Cell[] headerCells = sheet.getRow(0);

        StructModel s = new StructModel("A");

        for (int i = 0; i < headerCells.length; i++) {
            Cell headerCell = headerCells[i];

            s.append(new StringModel("", headerCell.getContents()));
        }

        ArrayModel arr = new ArrayModel(s.getFullFieldName());

        int rows = sheet.getRows();

        for (int i = 1; i < rows; ++i) {
            Cell[] cells = sheet.getRow(i);

            s = new StructModel("A");

            for (int j = 0; j < cells.length; j++) {
                Cell cell = cells[j];
View Full Code Here


   * @see net.sourceforge.squirrel_sql.plugins.dataimport.importer.IFileImporter#getPreview(int)
   */
  public String[][] getPreview(int noOfLines) throws IOException {
    String[][] data = null;
    Workbook wb = null;
    Sheet sht = null;
    try {
      wb = Workbook.getWorkbook(importFile);
      sht = getSheet(wb);
    } catch (BiffException be) {
      throw new IOException(be.toString());
    }

    int y = 0;
    int x = 0;
    int maxLines = (noOfLines < sht.getRows()) ? noOfLines : sht.getRows();
    data = new String[maxLines][sht.getColumns()];

    for (y = 0; y < maxLines; y++) {
      for (x = 0; x < sht.getColumns(); x++) {
        data[y][x] = sht.getCell(x, y).getContents();
      }
    }
    wb.close();
   
    return data;
View Full Code Here

  public JComponent getConfigurationPanel() {
    return new ExcelSettingsPanel(settings, importFile);
  }
 
  private Sheet getSheet(Workbook wb) {
    Sheet s = null;
    if (settings.getSheetName() != null) {
      s = wb.getSheet(settings.getSheetName());
    }
    if (s == null) {
      s = wb.getSheet(0);
View Full Code Here

        InputStream is = new URL(targetUrlStr).openStream();
       
        Workbook workbook = Workbook.getWorkbook(tis);
        Workbook resultWorkbook = Workbook.getWorkbook(is);   
       
        Sheet resultSheets[] = resultWorkbook.getSheets();
        Sheet sheets[] = workbook.getSheets();
       
        for(int i=0; i<sheets.length; i++){
          Sheet sheet = sheets[i];
          Sheet resultSheet = resultSheets[i];
         
          for(int col = 0; col < sheet.getColumns(); col++){
            for(int row = 0; row < sheet.getRows(); row++){
              try{
                Cell cell = sheet.getCell(col,row);       
       
                String expression = cell.getContents();
  //  System.out.println("ExcelActivity:: onComplete: expression:"+expression);
                if(expression.startsWith("<%=*")){ //if the expression contains any value need to evaluate.
                  String k = expression.substring(4, expression.indexOf("%>"));
  //  System.out.println("ExcelActivity:: key:"+k);
                  Cell resultCell = resultSheet.getCell(col, row);
                  String val = resultCell.getContents();
  //  System.out.println("ExcelActivity:: val:"+val);
                  definition.getProcessVariable(k).set(instance, "", val);
                }else
                if(expression.startsWith("<%->")){ //if the expression contains any value need to evaluate.
                  String k = expression.substring(4, expression.indexOf("%>"));
                  Cell resultCell = resultSheet.getCell(col-1, row);
                  String val = resultCell.getContents();
                  definition.getProcessVariable(k).set(instance, "", val);
                }
              }catch(Exception e){
  //  System.out.println("ExcelActivity:: error in setting value");
View Full Code Here

        String[][] reglas = new String[limite.getFilas()][limite.getColumnas()];
        System.out.println("Nombre Puntos");
        for (int i = 0; i < limite.getFilas(); i++) {
            for (int j = 0; j < limite.getColumnas(); j++) {

                Sheet sheet = libroTrabajo.getSheet(this.hojaNombresPuntos);
                //recordar que primero son las columnas y luego filas
                Cell a1 = sheet.getCell(j + 1, i + 1);
                String stringfilas = a1.getContents();
                if (a1.getType() == CellType.EMPTY) {
                    stringfilas = "-";
                }
                reglas[i][j] = stringfilas;
View Full Code Here

        String[][] coordenadas = new String[limite.getFilas()][limite.getColumnas()];
        System.out.println("Coordenadas");
        for (int i = 0; i < limite.getFilas(); i++) {
            for (int j = 0; j < limite.getColumnas(); j++) {

                Sheet sheet = libroTrabajo.getSheet(this.hojaCoordenadasPuntos);
                //recordar que primero son las columnas y luego filas
                Cell a1 = sheet.getCell(j + 1, i + 1);


                String stringfilas = a1.getContents();
                if (a1.getType() == CellType.EMPTY) {
                    stringfilas = "-";
View Full Code Here

        String[][] reglas = new String[limite.getFilas()][limite.getColumnas()];
        System.out.println("HEURISTICAS");
        for (int i = 0; i < limite.getFilas(); i++) {
            for (int j = 0; j < limite.getColumnas(); j++) {

                Sheet sheet = libroTrabajo.getSheet(this.hojaHeuristica);
                //recordar que primero son las columnas y luego filas
                Cell a1 = sheet.getCell(j + 1, i + 1);


                String stringfilas = a1.getContents();
                if (a1.getType() == CellType.EMPTY) {
                    stringfilas = "-";
View Full Code Here

        String[][] reglas = new String[limite.getFilas()][limite.getColumnas()];
        System.out.println("REGLAS");
        for (int i = 0; i < limite.getFilas(); i++) {
            for (int j = 0; j < limite.getColumnas(); j++) {

                Sheet sheet = libroTrabajo.getSheet(this.hojaReglas);
                //recordar que primero son las columnas y luego filas
                Cell a1 = sheet.getCell(j + 1, i + 1);
                String stringfilas = a1.getContents();
                if (a1.getType() == CellType.EMPTY) {
                    stringfilas = "-";
                }
                reglas[i][j] = stringfilas;
View Full Code Here

            System.out.println("ARCHIVO ENTRADA: ABIERTO-CERRADO");
        }
        int columnas, filas;
        if (elemento == ArchivoExcelBaseConocimiento.REGLAS) {
            System.out.println("Limite reglas");
            Sheet sheet = libroTrabajo.getSheet(this.hojaConfiguraciones);
            //recordar que primero son las columnas y luego filas
            Cell a1 = sheet.getCell(1, 3);
            Cell b2 = sheet.getCell(2, 3);

            String stringfilas = a1.getContents();
            String strincolumnas = b2.getContents();

            columnas = Integer.parseInt(strincolumnas);
            filas = Integer.parseInt(stringfilas);


            System.out.println("filas:      " + stringfilas + "\ncolumnas:   " + strincolumnas);
            return new Limite(filas, columnas);
        } else if (elemento == ArchivoExcelBaseConocimiento.NOMBRESPUNTOS) {
            System.out.println("Limite nombre puntos");
            Sheet sheet = libroTrabajo.getSheet(this.hojaConfiguraciones);
            //recordar que primero son las columnas y luego filas
            Cell a1 = sheet.getCell(1, 2);
            Cell b2 = sheet.getCell(2, 2);

            String stringfilas = a1.getContents();
            String strincolumnas = b2.getContents();

            columnas = Integer.parseInt(strincolumnas);
            filas = Integer.parseInt(stringfilas);


            System.out.println("filas:      " + stringfilas + "\ncolumnas:   " + strincolumnas);
            return new Limite(filas, columnas);
        } else if (elemento == ArchivoExcelBaseConocimiento.HEURISTICA) {
            System.out.println("Limite heuristica");
            Sheet sheet = libroTrabajo.getSheet(this.hojaConfiguraciones);
            //recordar que primero son las columnas y luego filas
            Cell a1 = sheet.getCell(1, 1);
            Cell b2 = sheet.getCell(2, 1);

            String stringfilas = a1.getContents();
            String strincolumnas = b2.getContents();

            columnas = Integer.parseInt(strincolumnas);
            filas = Integer.parseInt(stringfilas);


            System.out.println("filas:      " + stringfilas + "\ncolumnas:   " + strincolumnas);
            return new Limite(filas, columnas);
        } else if (elemento == ArchivoExcelBaseConocimiento.COORDENADASPUNTOS) {
            System.out.println("Limite coordenada puntos");
            Sheet sheet = libroTrabajo.getSheet(this.hojaConfiguraciones);
            //recordar que primero son las columnas y luego filas
            Cell a1 = sheet.getCell(1, 0);
            Cell b2 = sheet.getCell(2, 0);

            String stringfilas = a1.getContents();
            String strincolumnas = b2.getContents();

            columnas = Integer.parseInt(strincolumnas);
View Full Code Here

    excelView.render(new HashMap(), request, response);

    Workbook wb = Workbook.getWorkbook(new ByteArrayInputStream(response.getContentAsByteArray()));
    assertEquals("Test Sheet", wb.getSheet(0).getName());
    Sheet sheet = wb.getSheet("Test Sheet");
    Cell cell = sheet.getCell(2, 4);
    assertEquals("Test Value", cell.getContents());
  }
View Full Code Here

TOP

Related Classes of jxl.Sheet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.