/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.triz.util;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Service;

/**
 *
 * @author amtou
 */
@Service()
public class UtilExcel {
    public void miseEnForm(Object document) {   
        System.out.println("miseEnForm");
        XSSFWorkbook workbook = (XSSFWorkbook) document;
        XSSFSheet sheet = workbook.getSheetAt(0);
//    CellStyle totalCellStyle = workbook.createCellStyle(); 
//
//    totalCellStyle.setDataFormat(workbook.createDataFormat().getFormat("#,##0.00"));
//
//    Cell currentCell = workbook.getSheetAt(0).getRow(0).getCell(0);
//
//
//    currentCell.setCellValue(Double.parseDouble(currentCell.getStringCellValue()));
//    currentCell.setCellStyle(defaultCellStyle);
    
    
        int ligne=0;
        while(true){
            XSSFRow row = sheet.getRow(ligne);

            System.out.println("ligne :"+ligne+" ; Row :"+row);
            ligne++;
            if(row==null){
                break;
            }
            int colon = 0;
            while(true){
                XSSFCell cell = row.getCell(colon);
                System.out.println("ligne :"+ligne+"; colon :"+colon+" ; Cell :"+cell);
                if(cell==null){
                    break;
                }
            }
        }

    }
}
