读取一行

@param row 行
@param cellEditor 单元格编辑器
@return 单元格值列表
433869
public static List<Object> readRow(Row row, CellEditor cellEditor) {
		if (null == row) {
			return new ArrayList<>(0);
		}
		final short length = row.getLastCellNum();
		if (length < 0) {
			return new ArrayList<>(0);
		}
		final List<Object> cellValues = new ArrayList<>((int) length);
		Object cellValue;
		boolean isAllNull = true;
		for (short i = 0; i < length; i++) {
			cellValue = CellUtil.getCellValue(row.getCell(i), cellEditor);
			isAllNull &= StrUtil.isEmptyIfStr(cellValue);
			cellValues.add(cellValue);
		}

		if (isAllNull) {
			// 如果每个元素都为空，则定义为空行
			return new ArrayList<>(0);
		}
		return cellValues;
	}
304774
Cell<V> finder(int row, int column) {
        @SuppressWarnings({ "unchecked", "rawtypes" })
        Cell<V> finder = new ImmutableCell(row, column, "");
        return finder;
    }
290276
public Cell addCell(Row row, String label) {
        Cell cell = new Cell(label);
        row.addChild(cell);
        return cell;
    }
710715
@Override
	public boolean isCellEditable(final int row, final int column) {
		final int index = table.convertColumnIndexToView(column);
		return table.isEnabled() && table.getColumnModel().getColumn(index).getCellEditor() != null;
	}
702284
public double[] getRow(int row) {
    double[] rowArray = new double[getColumnCount()];
    for (int i = 0; i < getColumnCount(); i++) {
      rowArray[i] = get(row, i);
    }
    return rowArray;
  }
146484
public ArrayList<String> getDiscreteRowValues(String row) throws Exception {
		HashMap<String, String> hashMapValues = new HashMap<String, String>();
		ArrayList<String> values = new ArrayList<String>();
		for (String column : getColumns()) {
			String value = getCell(row, column);
			if (!hashMapValues.containsKey(value)) {
				hashMapValues.put(value, value);
				values.add(value);
			}
		}
		return values;
	}
1335038
public void set(final int row, final int col, final Object o) {
    if (o == null)
      cellValues[row][col] = new IcedWrapper(null);
    else if (o instanceof Double && Double.isNaN((double)o))
      cellValues[row][col] = new IcedWrapper(Double.NaN);
    else if (o instanceof int[])
      cellValues[row][col] = new IcedWrapper(Arrays.toString((int[])o));
    else if (o instanceof long[])
      cellValues[row][col] = new IcedWrapper(Arrays.toString((long[])o));
    else if (o instanceof float[])
      cellValues[row][col] = new IcedWrapper(Arrays.toString((float[])o));
    else if (o instanceof double[])
      cellValues[row][col] = new IcedWrapper(Arrays.toString((double[])o));
    else if (colTypes[col]=="string")
      cellValues[row][col] = new IcedWrapper(o.toString());
    else
      cellValues[row][col] = new IcedWrapper(o);
  }

  /**
   * Print table to String, using 2 spaces for padding between columns
   * @return String containing the ASCII version of the table
   */
  public String toString() {
    return toString(2, true);
  }
  /**
   * Print table to String, using user-given padding
   * @param pad number of spaces for padding between columns
   * @return String containing the ASCII version of the table
   */
  public String toString(final int pad) {
    return toString(pad, true);
  }

  private static int PRINTOUT_ROW_LIMIT = 20;
  private boolean skip(int row) {
    assert(PRINTOUT_ROW_LIMIT % 2 == 0);
    if (getRowDim() <= PRINTOUT_ROW_LIMIT) return false;
    if (row <= PRINTOUT_ROW_LIMIT/2) return false;
    if (row >= getRowDim()-PRINTOUT_ROW_LIMIT/2) return false;
    return true;
  }
  /**
   * Print table to String, using user-given padding
   * @param pad number of spaces for padding between columns
   * @param full whether to print the full table (otherwise top 5 and bottom 5 rows only)
   * @return String containing the ASCII version of the table
   */
  public String toString(final int pad, boolean full) {
    if (pad < 0)
      throw new IllegalArgumentException("pad must be a non-negative integer");

    final int rowDim = getRowDim();
    final int colDim = getColDim();

    final int actualRowDim = full ? rowDim : Math.min(PRINTOUT_ROW_LIMIT+1, rowDim);

    final String[][] cellStrings = new String[actualRowDim + 1][colDim + 1];
    for (String[] row: cellStrings)
      Arrays.fill(row, "");

    cellStrings[0][0] = colHeaderForRowHeaders != null ? colHeaderForRowHeaders : "";
    int row = 0;
    for (int r = 0; r < rowDim; ++r) {
      if (!full && skip(r)) continue;
      cellStrings[row+1][0] = rowHeaders[r];
      row++;
    }
    for (int c = 0; c < colDim; ++c)
      cellStrings[0][c+1] = colHeaders[c];

    for (int c = 0; c < colDim; ++c) {
      final String formatString = colFormats[c];
      row = 0;
      for (int r = 0; r < rowDim; ++r) {
        if (!full && skip(r)) continue;
        Object o = get(r,c);
        if ((o == null) || o instanceof Double && isEmpty((double)o)){
          cellStrings[row + 1][c + 1] = "";
          row++;
          continue;
        } else if (o instanceof Double && Double.isNaN((double)o)) {
          cellStrings[row + 1][c + 1] = "NaN";
          row++;
          continue;
        }
        try {
          if (o instanceof Double) cellStrings[row + 1][c + 1] = String.format(formatString, (Double) o);
          else if (o instanceof Float) cellStrings[row + 1][c + 1] = String.format(formatString, (Float) o);
          else if (o instanceof Integer) cellStrings[row + 1][c + 1] = String.format(formatString, (Integer) o);
          else if (o instanceof Long) cellStrings[row + 1][c + 1] = String.format(formatString, (Long) o);
          else if (o instanceof String) cellStrings[row + 1][c + 1] = (String)o;
          else cellStrings[row + 1][c + 1] = String.format(formatString, cellValues[r][c]);
        } catch(Throwable t) {
          cellStrings[row + 1][c + 1] = o.toString();
        }
        row++;
      }
    }

    final int[] colLen = new int[colDim + 1];
    for (int c = 0; c <= colDim; ++c) {
      for (int r = 0; r <= actualRowDim; ++r) {
        colLen[c] = Math.max(colLen[c], cellStrings[r][c].length());
      }
    }

    final StringBuilder sb = new StringBuilder();
    if (tableHeader.length() > 0) {
      sb.append(tableHeader);
    }
    if (tableDescription.length() > 0) {
      sb.append(" (").append(tableDescription).append(")");
    }
    sb.append(":\n");
    for (int r = 0; r <= actualRowDim; ++r) {
      int len = colLen[0];
      if (actualRowDim != rowDim && r - 1 == PRINTOUT_ROW_LIMIT/2) {
        assert(!full);
        sb.append("---");
      } else {
        if (len > 0)
          sb.append(String.format("%" + colLen[0] + "s", cellStrings[r][0]));
        for (int c = 1; c <= colDim; ++c) {
          len = colLen[c];
          if (len > 0)
            sb.append(String.format("%" + (len + pad) + "s", cellStrings[r][c].equals("null") ? "" : cellStrings[r][c]));
        }
      }
      sb.append("\n");
    }

   return sb.toString();
  }
782072
public Object get(int row, @NotNull String column) {
        return rows.get(row).get(column);
    }
178037
public static void writeRow(Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader) {
		int i = 0;
		Cell cell;
		for (Object value : rowData) {
			cell = row.createCell(i);
			CellUtil.setCellValue(cell, value, styleSet, isHeader);
			i++;
		}
	}
136430
@Override
	public final Object getValueAt(final int row, final int col) {
		TableTreeNode rowNode = getNodeAtLine(row);
		return getValueAt(rowNode, col);
	}
114878
protected void formatCell (HTMLTable.CellFormatter formatter, int row, int col, int limit)
    {
        formatter.setHorizontalAlignment(row, col, _cellHorizAlign);
        formatter.setVerticalAlignment(row, col, _cellVertAlign);
        formatter.setStyleName(row, col, "Cell");
        if (row == (limit-1)/_cols) {
            formatter.addStyleName(row, col, "BottomCell");
        } else if (row == 0) {
            formatter.addStyleName(row, col, "TopCell");
        } else {
            formatter.addStyleName(row, col, "MiddleCell");
        }
    }
754761
function(ev, rowIndex) {
		
		// Get a particular CellEditor
		var elCell = ev.target, oColumn;
		elCell = this.datatable.getTdEl(elCell);
		if(elCell) {
			oColumn = this.datatable.getColumn(elCell);
			if(oColumn && oColumn.editor) {
				var oCellEditor = this.datatable._oCellEditor;
				// Clean up active CellEditor
				if(oCellEditor) {
					// Return if field isn't validated
					if( !oCellEditor._inputExField.validate() ) {
						return;
					}
				}
			}
		}

		// Only if the cell is inputEx valid
		this.datatable.onEventShowCellEditor(ev);
		
   }
1278546
public void generate( String templateName,
                          Row row ) {
        try {
            CompiledTemplate template = getTemplate( templateName );
            VariableResolverFactory factory = new MapVariableResolverFactory();
            Map<String, Object> vars = new HashMap<String, Object>();

            initializePriorCommaConstraints( vars );
            initializeHasPriorJunctionConstraint( vars );

            vars.put( "row",
                      row );

            for ( Cell cell : row.getCells() ) {
                cell.addValue( vars );
            }

            String drl = String.valueOf( TemplateRuntime.execute( template,
                                                                  vars,
                                                                  factory,
                                                                  registry ) );

            rules.add( drl );
        } catch ( Exception e ) {
            throw new RuntimeException( e );
        }
    }
873855
public Object[] getRow(int row) {
    Object[] ret = new Object[columns.size()];
    for(int c = 0; c < columns.size(); c++) {
      ret[c] = data(row, c);
    }
    return ret;
  }
803137
public String getCellValue(int rowNumber, int cellNumber) {
        String result;
        checkRowAndCell(rowNumber, cellNumber);
        Sheet sheet = this.workbook.getSheet(this.sheetName);
        Row row = sheet.getRow(--rowNumber);
        Cell cell = row.getCell(--cellNumber);
        switch (cell.getCellTypeEnum()) {
            case BLANK:
                result = cell.getStringCellValue();
                break;
            case BOOLEAN:
                result = String.valueOf(cell.getBooleanCellValue());
                break;
            case ERROR:
                result = String.valueOf(cell.getErrorCellValue());
                break;
            case FORMULA:
                result = cell.getCellFormula();
                break;
            case NUMERIC:
                if (DateUtil.isCellDateFormatted(cell)) {
                    result = format.format(cell.getDateCellValue());
                } else {
                    result = String.valueOf(cell.getNumericCellValue());
                }
                break;
            case STRING:
                result = cell.getRichStringCellValue().getString();
                break;
            default:
                result = cell.getStringCellValue();
                break;
        }
        return result;
    }
1367805
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
    {
        this.setControlValue(value);
        return this;
    }
805517
public static void renderRow(XWPFTable table, int row, RowRenderData rowData) {
        if (null == rowData || rowData.size() <= 0) return;
        XWPFTableRow tableRow = table.getRow(row);
        ObjectUtils.requireNonNull(tableRow, "Row " + row + " do not exist in the table");

        TableStyle style = rowData.getStyle();
        List<TextRenderData> cellList = rowData.getRowData();
        XWPFTableCell cell = null;

        for (int i = 0; i < cellList.size(); i++) {
            cell = tableRow.getCell(i);
            if (null == cell) {
                logger.warn("Extra cell data at row {}, but no extra cell: col {}", row, cell);
                break;
            }

            // 处理单元格样式
            if (null != style && null != style.getBackgroundColor()) {
                cell.setColor(style.getBackgroundColor());
            }

            TextRenderData cellData = cellList.get(i);
            String cellText = cellData.getText();
            if (StringUtils.isBlank(cellText)) continue;

            String[] fragment = cellText.split(TextRenderPolicy.REGEX_LINE_CHARACTOR);
            if (null == fragment) continue;

            // 处理单元格数据
            XWPFParagraph par;
            XWPFRun run;
            for (int j = 0; j < fragment.length; j++) {
                if (0 == j) {
                    CTTc ctTc = cell.getCTTc();
                    CTP ctP = (ctTc.sizeOfPArray() == 0) ? ctTc.addNewP() : ctTc.getPArray(0);
                    par = new XWPFParagraph(ctP, cell);
                } else {
                    par = cell.addParagraph();
                }
                StyleUtils.styleTableParagraph(par, style);
                run = par.createRun();
                StyleUtils.styleRun(run, cellData.getStyle());
                run.setText(fragment[j]);
            }
        }
    }