i have read this page but i cannot apply to may code.
can you help meplease?
the code is:
SimpleDateFormat fechabase = new
SimpleDateFormat("dd-MM-yyyy_HH_mm_ss");
   short rowNum = 0;
   short colNum = 0;
   HSSFRow row = null;
   HSSFWorkbook wb = new HSSFWorkbook();
   HSSFSheet sheet = wb.createSheet(fechabase.format(new Date()));
   String fichero="xx.xls";
   String path="c:\\";
   public String getNombreFichero() {
       return fichero;
   }

   public void setNombreFichero(String fichero) {
       this.fichero = fichero;
   }
   public String getPath() {
       return path;
   }

   public void setPath(String path) {
       this.path = path;
   }

   public void getEXCEL(String xml) {
       Document doc = null;
       DocumentBuilder db = null;
       try{
           db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
           doc = db.parse(new ByteArrayInputStream(xml.getBytes()));
       }catch(Exception e){
           System.out.println("Error en el metodo inicoexcel de la
creaccion del excel: " + e.getMessage());
       }
       row = sheet.createRow(rowNum);
       try{
           buscar(doc, 0);
       }catch(Exception e){
           e.printStackTrace();
       }
       try{
           FileOutputStream fileOut = new FileOutputStream(path+fichero);
           wb.write(fileOut);
           fileOut.close();
       }catch(Exception e){
           e.printStackTrace();
           System.out.println("Error creando el fichero de excel
"+e.getMessage());
       }
   }

   public void buscar(Node node, int level) {
       NodeList listar = node.getChildNodes();
       for (int i=0; i<listar.getLength(); i++) {
           Node childNode = listar.item(i);
           if (level==3 && childNode.getNodeType()==Node.TEXT_NODE) {
               
System.out.println(childNode.getParentNode().getNodeName()+"-"+childNode.getNodeValue());
               if(childNode.getParentNode().getNodeName().equals("cabecera")){
                   row.setHeightInPoints(35);
                   
row.createCell(colNum++).setCellValue(childNode.getNodeValue());
//**********
//**********here i want to put background collor and bold font
//**********
               }else{
               row.createCell(colNum++).setCellValue(childNode.getNodeValue());
               }
               } else if (level==1 && childNode.getNodeType()==1) {
               colNum = 0;
               row = sheet.createRow(rowNum);
               ++rowNum;
           }
           buscar(childNode, level+1);
       }
   }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/



Reply via email to