Examples of XSSFCell


Examples of org.apache.poi.xssf.usermodel.XSSFCell

                        xhtml.characters(
                            formatter.formatRawCellContents(cell.getNumericCellValue(),
                                                            style.getDataFormat(),
                                                            style.getDataFormatString()));
                    } else {
                        XSSFCell xc = (XSSFCell) cell;
                        String rawValue = xc.getRawValue();
                        if (rawValue != null) {
                            xhtml.characters(rawValue);
                        }

                    }
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFCell

          if(cell.getCellType() == Cell.CELL_TYPE_FORMULA && formulasNotResults) {
            text.append(cell.getCellFormula());
          } else if(cell.getCellType() == Cell.CELL_TYPE_STRING) {
            text.append(cell.getRichStringCellValue().getString());
          } else {
            XSSFCell xc = (XSSFCell)cell;
            text.append(xc.getRawValue());
          }
         
          // Output the comment, if requested and exists
            Comment comment = cell.getCellComment();
          if(includeCellComments && comment != null) {
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFCell

      String xpathString = singleXmlCell.getXpath();
     
      Node result =  (Node) xpath.evaluate(xpathString,doc, XPathConstants.NODE);   
      String textContent = result.getTextContent();
      logger.log(POILogger.DEBUG,"Extracting with xpath "+xpathString+" : value is '"+textContent+"'");
      XSSFCell cell = singleXmlCell.getReferencedCell();
      logger.log(POILogger.DEBUG,"Setting '"+textContent+"' to cell "+cell.getColumnIndex()+"-"+cell.getRowIndex()+" in sheet "+cell.getSheet().getSheetName());
      cell.setCellValue(textContent);
     
     
     
     
    }
   
    for(Table table : tables){
     
      String commonXPath = table.getCommonXpath();
   
      NodeList result =  (NodeList) xpath.evaluate(commonXPath,doc, XPathConstants.NODESET);
     
      int rowOffset = table.getStartCellReference().getRow()+1;//the first row contains the table header
      int columnOffset = table.getStartCellReference().getCol()-1;
     
      for(int i = 0; i< result.getLength();i++){
       
        // TODO: implement support for denormalized XMLs (see OpenOffice part 4: chapter 3.5.1.7)
       
        for(XSSFXmlColumnPr xmlColumnPr: table.getXmlColumnPrs()){
         
          int localColumnId = (int)xmlColumnPr.getId();
         
          int rowId = rowOffset+i;
          int columnId = columnOffset+localColumnId;
         
         
          String localXPath = xmlColumnPr.getLocalXPath();
          localXPath = localXPath.substring(localXPath.substring(1).indexOf('/')+1);
         
          // Build an XPath to select the right node (assuming that the commonXPath != "/")
          String nodeXPath = commonXPath+"["+(i+1)+"]"+localXPath;
         
         
         
          // TODO: convert the data to the cell format 
          String value = (String) xpath.evaluate(nodeXPath,result.item(i), XPathConstants.STRING);
          logger.log(POILogger.DEBUG,"Extracting with xpath "+nodeXPath+" : value is '"+value+"'");
          XSSFRow row = table.getXSSFSheet().getRow(rowId);
          if(row==null){
            row = table.getXSSFSheet().createRow(rowId);
          }
         
          XSSFCell cell = row.getCell(columnId);
          if(cell==null){
            cell = row.createCell(columnId);
          }
          logger.log(POILogger.DEBUG,"Setting '"+value+"' to cell "+cell.getColumnIndex()+"-"+cell.getRowIndex()+" in sheet "+table.getXSSFSheet().getSheetName());
          cell.setCellValue(value.trim());
         
        }
         
       
       
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFCell

          if(cell.getCellType() == Cell.CELL_TYPE_FORMULA && formulasNotResults) {
            text.append(cell.getCellFormula());
          } else if(cell.getCellType() == Cell.CELL_TYPE_STRING) {
            text.append(cell.getRichStringCellValue().getString());
          } else {
            XSSFCell xc = (XSSFCell)cell;
            text.append(xc.getRawValue());
          }

          // Output the comment, if requested and exists
            Comment comment = cell.getCellComment();
          if(includeCellComments && comment != null) {
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFCell

             
              if(!xpath.matches(".*\\[.*")){
               
                // Exports elements and attributes mapped with simpleXmlCell
                if(simpleXmlCell!=null){
                  XSSFCell cell = simpleXmlCell.getReferencedCell();
                  if(cell!=null){
                    Node currentNode = getNodeByXPath(xpath,doc.getFirstChild(),doc,false);
                    STXmlDataType.Enum dataType = simpleXmlCell.getXmlDataType();           
                    mapCellOnNode(cell,currentNode,dataType)
                  }
                }
               
                // Exports elements and attributes mapped with tables
                if(table!=null){
                 
                  List<XSSFXmlColumnPr> tableColumns = table.getXmlColumnPrs();
                 
                  XSSFSheet sheet = table.getXSSFSheet();
                 
                  int startRow = table.getStartCellReference().getRow();
                  // In mappings created with Microsoft Excel the first row contains the table header and must be skipped
                  startRow +=1;
                 
                  int endRow = table.getEndCellReference().getRow();
                 
                  for(int i = startRow; i<= endRow; i++){
                    XSSFRow row = sheet.getRow(i);
                   
                    Node tableRootNode = getNodeByXPath(table.getCommonXpath(),doc.getFirstChild(),doc,true);
                   
                    short startColumnIndex = table.getStartCellReference().getCol();
                    for(int j = startColumnIndex; j<= table.getEndCellReference().getCol();j++){
                      XSSFCell cell = row.getCell(j);
                      if(cell!=null){
                        XSSFXmlColumnPr pointer = tableColumns.get(j-startColumnIndex);
                        String localXPath = pointer.getLocalXPath();
                        Node currentNode = getNodeByXPath(localXPath,tableRootNode,doc,false);
                        STXmlDataType.Enum dataType = pointer.getXmlDataType();
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFCell

                continue;
            }

            final int cellNum = cellRef.getCol();

            XSSFCell cell = row.getCell( cellNum, Row.CREATE_NULL_AS_BLANK  );

            assert cell!=null;
            if( cell==null ) {
                final String msg = String.format( "detected problem to get cell [%d,%d]. Will be ignored!", rowNum, cellNum );
                log.warn( msg);
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFCell

                    continue;
                }

                final int cellNum = startCell.getCol() + col;

                XSSFCell cell = row.getCell( cellNum, Row.CREATE_NULL_AS_BLANK  );

                assert cell!=null;
                if( cell==null ) {
                    final String msg = String.format( "detected problem to get cell [%d,%d]. Will be ignored!", rowNum, cellNum );
                    log.warn( msg);
                    continue;
                }

                if( cellType!=-1 && cellStyle!=null ) {
                  cell.setCellStyle(cellStyle);
                  cell.setCellType(cellType);
                }
                else {
                  cellStyle = cell.getCellStyle();
                  cellType = cell.getCellType();
                }

                setCellValue( cell, value, colPr.getXmlDataType() );
                //cell.setCellValue( ((SimpleValue)value).getStringValue() );
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFCell

            XSSFRow rr = (XSSFRow) r;


            for( Cell c: r ) {

                XSSFCell cc = (XSSFCell) c;


                CTCell ctc = cc.getCTCell();

                System.out.printf( "[%s]V(%s)S(%s)]|", c.getStringCellValue(), ctc.getV(),ctc.getS() );
            }
            System.out.println();
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFCell

          if(cell.getCellType() == Cell.CELL_TYPE_FORMULA && formulasNotResults) {
            text.append(cell.getCellFormula());
          } else if(cell.getCellType() == Cell.CELL_TYPE_STRING) {
            text.append(cell.getRichStringCellValue().getString());
          } else {
            XSSFCell xc = (XSSFCell)cell;
            text.append(xc.getRawValue());
          }

          // Output the comment, if requested and exists
            Comment comment = cell.getCellComment();
          if(includeCellComments && comment != null) {
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFCell

                return;
            }
        }

        // No supported styling applies to this cell
        XSSFCell xcell = (XSSFCell)cell;
        text.append( xcell.getRawValue() );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.