Package jxl

Examples of jxl.Sheet


    excelView.setApplicationContext(webAppCtx);
    excelView.setUrl("template");
    excelView.render(new HashMap(), request, response);

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


    excelView.setApplicationContext(webAppCtx);
    excelView.setUrl("template");
    excelView.render(new HashMap(), request, response);

    Workbook wb = Workbook.getWorkbook(new ByteArrayInputStream(response.getContentAsByteArray()));
    Sheet sheet = wb.getSheet("Sheet1");
    Cell cell = sheet.getCell(0, 0);
    assertEquals("Test Template American English", cell.getContents());
  }
View Full Code Here

    excelView.setApplicationContext(webAppCtx);
    excelView.setUrl("template");
    excelView.render(new HashMap(), request, response);

    Workbook wb = Workbook.getWorkbook(new ByteArrayInputStream(response.getContentAsByteArray()));
    Sheet sheet = wb.getSheet("Sheet1");
    Cell cell = sheet.getCell(0, 0);
    assertEquals("Test Template auf Deutsch", cell.getContents());
  }
View Full Code Here

  /**Функция чтение с листа xls и вытаскивания записей построчно*/
  public void readFromSheet(){
    if (!ExcelWorker.isScheduleOpened()){
      return;
    }
    Sheet scheduleSheet = null;
    try {
      scheduleSheet = ExcelWorker.getSheetOfSchedule(0);
    } catch (ScheduleIsNotOpenedException e) {
      // Надо обработать правильно! По сути не должно выскакивать, т.к. проверяется выше в if
      e.printStackTrace();
    }
    int added = 0//ДЛЯ дебага
    int notAdded = 0//для дебага вывести в Log
    for (int i = 1; i < scheduleSheet.getRows(); i++) {
      Cell[] curE = scheduleSheet.getRow(i);
      if (!isValidRow(curE)) {
        notAdded++;//нужно сделать список некорректных записей
        continue;
      } else {
        Time time = convertToEnumTime(ExcelWorker.splitStr(curE[2].getContents())); // конвертируем время
View Full Code Here

    ArrayList<MovimentoContabile> listaMovimenti= new ArrayList<MovimentoContabile>();

    Workbook workbook = Workbook.getWorkbook(fileToUpload);
    try {
      Sheet sheet = workbook.getSheet(0);

      for (int currentRow = RIGHE_INTESTAZIONE; currentRow < sheet.getRows(); currentRow++) {

        societaVeicolo = sheet.getCell(0, currentRow);
        if (isEmpty(societaVeicolo))
          throw new UnvalidCellException(currentRow+1, 1);
       
        dataRegistrazione = sheet.getCell(1, currentRow);
        if (!(dataRegistrazione instanceof DateCell))
          throw new UnvalidCellException(currentRow+1, 2);
       
        dataCompetenza = sheet.getCell(2, currentRow);
        if (!(dataCompetenza instanceof DateCell))
          throw new UnvalidCellException(currentRow+1, 3);
       
        tipoMovimento = sheet.getCell(3, currentRow);
        if (isEmpty(tipoMovimento))
          throw new UnvalidCellException(currentRow+1, 4);

        causale = sheet.getCell(4, currentRow);
        if (isEmpty(causale))
          throw new UnvalidCellException(currentRow+1, 5);

        progressivoCausale = sheet.getCell(5, currentRow);
        if (!(progressivoCausale instanceof NumberCell))
          throw new UnvalidCellException(currentRow+1, 6);
       
        gruppo = sheet.getCell(6, currentRow);
        if (!(gruppo instanceof NumberCell))
          throw new UnvalidCellException(currentRow+1, 7);
       
        mastro = sheet.getCell(7, currentRow);
        if (!(mastro instanceof NumberCell))
          throw new UnvalidCellException(currentRow+1, 8);
       
        conto = sheet.getCell(8, currentRow);
        if (!(conto instanceof NumberCell))
          throw new UnvalidCellException(currentRow+1, 9);
       
        dare = sheet.getCell(9, currentRow);
        if (!(dare instanceof NumberCell))
          throw new UnvalidCellException(currentRow+1, 10);
       
        avere = sheet.getCell(10, currentRow);
        if (!(avere instanceof NumberCell))
          throw new UnvalidCellException(currentRow+1, 11);
       
        descrizione = sheet.getCell(11, currentRow);
       
        dataValuta = sheet.getCell(12, currentRow);
        if (!isEmpty(dataValuta) && !(dataValuta instanceof DateCell))
          throw new UnvalidCellException(currentRow+1, 13);
       
        finanziamento = sheet.getCell(13, currentRow);
        if (!isEmpty(finanziamento) && !(finanziamento instanceof NumberCell))
          throw new UnvalidCellException(currentRow+1, 14);
       

        if (emptyRow()) {
View Full Code Here

    {
      xlsFilePath = ClassLoader.getSystemResource(xlsFile).getFile();
     
      Workbook workbook = Workbook.getWorkbook(new File( xlsFilePath ) );
     
      Sheet sheet = workbook.getSheet(sheetName);
       
        int startRow, startCol, endRow, endCol, ci, cj;
       
        Cell tableStart = sheet.findCell(tableName);
        startRow = tableStart.getRow();
        startCol = tableStart.getColumn();

        Cell tableEnd= sheet.findCell(tableName, startCol+1,startRow+1, 100, 64000false);               

        endRow=tableEnd.getRow();
        endCol=tableEnd.getColumn();
       
        LOGGER.debug("startRow="+startRow+", endRow="+endRow+", startCol="+startCol+", endCol="+endCol);
       
        tableArray = new String[endRow-startRow-1][endCol-startCol-1];
        ci=0;

        for (int i=startRow+1;i<endRow;i++,ci++)
        {
          cj=0;
            for (int j=startCol+1;j<endCol;j++,cj++)
            {
              tableArray[ci][cj]=sheet.getCell(j,i).getContents();
            }
        }
       
        // TBD: verify if it's really ok to throw this exception here
        if ( tableArray.length <= 0 )
View Full Code Here

       
        try {
         
            classeur = Workbook.getWorkbook(fluxFichier);
           
            Sheet feuille = classeur.getSheet(nomDeLaFeuille);
           
            final int nombreDeLignes = feuille.getRows();
           
            int[] colonnesALire = decodeur.colonnesALire();
           
            for (int numeroDeLigne = 0; numeroDeLigne < nombreDeLignes; numeroDeLigne ++) {
                Map<Integer,String> ligne = new HashMap<Integer,String>();
               
                for (int numeroDeColonne : colonnesALire) {
                   
                  String valeurDeLaCellule = feuille.getCell(numeroDeColonne,numeroDeLigne).getContents();
                    ligne.put(numeroDeColonne,valeurDeLaCellule);
                }
               
                objetsImportes.add(decodeur.decode(ligne));
            }
View Full Code Here

        try {
            WorkbookSettings ws = new WorkbookSettings();
            Workbook workbook = Workbook.getWorkbook( inStream, ws);

            if ( _useFirstSheet ) {
                Sheet sheet = workbook.getSheet( 0 );
                processSheet( sheet,
                              _listeners.get( DEFAULT_RULESHEET_NAME ) );
            } else {
                for ( String sheetName : _listeners.keySet() ) {
                    Sheet sheet = workbook.getSheet( sheetName );
                    processSheet( sheet,
                                  _listeners.get( sheetName ) );

                }
            }
View Full Code Here

    try {

      Workbook book = Workbook.getWorkbook(new File(excel_file_name));
      sl = new ArrayList();
      for (int s = 0; s < sheet_count; s++) {
        Sheet sheet = book.getSheet(s);
        al = new ArrayList();
        Cell cellKey;
        Cell cellValue;
        for (int i = 0; i < column_count; i++) {
          List columndatas = new ArrayList();
          cellKey = sheet.getCell(i, i);
          for (int k = 0; k < row_count; k++) {
            cellValue = sheet.getCell(i, k);
            // System.out.println("��:" + (k + 1) + "�е�" + (i + 1) +
            // "��ֵ��:"+ cellValue.getContents());
            columndatas.add(cellValue.getContents());
          }// end for k
          al.add(columndatas);// ��һ�����ݷ�װ���ܵ�list��
View Full Code Here

   */
  public static List readExcelFileASheetByName(int row_count,
      int column_count, String excel_file_name) {
    try {
      Workbook book = Workbook.getWorkbook(new File(excel_file_name));
      Sheet sheet = book.getSheet(0);
      al = new ArrayList();
      Cell cellKey;
      Cell cellValue;
      for (int i = 0; i < column_count; i++) {
        List columndatas = new ArrayList();
        cellKey = sheet.getCell(i, i);
        for (int k = 0; k < row_count; k++) {
          cellValue = sheet.getCell(i, k);
          // System.out.println("��:" + (k + 1) + "�е�" + (i + 1) +
          // "��ֵ��:"+ cellValue.getContents());
          columndatas.add(cellValue.getContents());
        }// end for k
        al.add(columndatas);// ��һ�����ݷ�װ���ܵ�list��
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.