Yes, i didn't have in my classpath : xmlbeans-2.3.0.jar.
So, it's good.
Thank you very much Nick! 

The code to read and write a .xlsx file it's:
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;


public class LireEcrire {

        /**
         * @param args
         */
        public static void main(String[] args) {
                try {
                //pour ouvrir un .xlsx
                InputStream is = new FileInputStream("workbook.xlsx");
                OPCPackage opc=OPCPackage.open(is);
            XSSFWorkbook wb= new XSSFWorkbook(opc); 
                
                XSSFSheet sheet = (XSSFSheet)wb.getSheetAt(0);//onglet 0
                XSSFRow row = sheet.getRow(0);//ligne 0
                XSSFCell cell = row.getCell(8);// colonne 8 (D)
                //pour ouvrir un .xlsx
            FormulaEvaluator evaluator =
wb.getCreationHelper().createFormulaEvaluator();
            evaluator.evaluate(cell);
            if (cell == null)
                cell = row.createCell(8);
            cell.setCellType(Cell.CELL_TYPE_STRING);
            cell.setCellValue("sisi");

            // Write the output to a file
            FileOutputStream fileOut = new FileOutputStream("workbook.xlsx");
            wb.write(fileOut);
            fileOut.close();
                } catch (FileNotFoundException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (InvalidFormatException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
        }
}


--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/java-lang-NoClassDefFoundError-org-apache-xmlbeans-XmlException-tp5501612p5508583.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to