Awesome quick-guide is at: http://jakarta.apache.org/poi/hssf/quick-guide.html
For your question click on "Custom colors" or "Fills and colors" HTH, :) ~ amol -----Original Message----- From: Dionisio Ruiz de Z�rate [mailto:[EMAIL PROTECTED] Sent: Friday, January 28, 2005 10:28 AM To: [email protected] Subject: help for formatting celds Hello y have the bellow code, using one xml i build one excel file. i cannot formatting celds. i want to put background collor and bold (font) but i cannot make it (i don't know how can i make it). Can you help me? thanks 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.get NodeValue()); 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/ --------------------------------------------------------------------- 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/
