本文整理了Java中org.apache.poi.ss.usermodel.Cell.getRow()
方法的一些代码示例,展示了Cell.getRow()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cell.getRow()
方法的具体详情如下:
包路径:org.apache.poi.ss.usermodel.Cell
类名称:Cell
方法名:getRow
[英]Returns the Row this cell belongs to
[中]返回此单元格所属的行
代码示例来源:origin: pentaho/pentaho-kettle
public int getRow() {
Row row = cell.getRow();
return row.getRowNum();
}
}
代码示例来源:origin: kiegroup/optaplanner
protected String readStringParameter(Row row, String key) {
Cell keyCell = row.getCell(0);
if (!key.equals(keyCell.getStringCellValue())) {
throw new IllegalArgumentException("The keyCell (" + keyCell.getRow().getRowNum() + ","
+ keyCell.getColumnIndex() + ") with value (" + keyCell.getStringCellValue()
+ ") is expected to have the key (" + key + ")");
}
Cell valueCell = row.getCell(1);
return valueCell.getStringCellValue();
}
代码示例来源:origin: kiegroup/optaplanner
protected double readDoubleParameter(Row row, String key) {
Cell keyCell = row.getCell(0);
if (!key.equals(keyCell.getStringCellValue())) {
throw new IllegalArgumentException("The keyCell (" + keyCell.getRow().getRowNum() + ","
+ keyCell.getColumnIndex() + ") with value (" + keyCell.getStringCellValue()
+ ") is expected to have the key (" + key + ")");
}
Cell valueCell = row.getCell(1);
return valueCell.getNumericCellValue();
}
}
代码示例来源:origin: kiegroup/optaplanner
protected long readLongCell(Cell cell) {
double d = cell.getNumericCellValue();
long l = (long) d;
if (d - (double) l != 0.0) {
throw new IllegalArgumentException("The keyCell (" + cell.getRow().getRowNum() + ","
+ cell.getColumnIndex() + ") with value (" + d + ") is expected to be a long.");
}
return l;
}
代码示例来源:origin: kiegroup/optaplanner
protected void assertCellConstant(Cell cell, String constant) {
if (!constant.equals(cell.getStringCellValue())) {
throw new IllegalArgumentException("The cell (" + cell.getRow().getRowNum() + ","
+ cell.getColumnIndex() + ") with value (" + cell.getStringCellValue()
+ ") is expected to have the constant (" + constant + ")");
}
}
代码示例来源:origin: org.apache.poi/poi
/**
* Looks for text in the cell that should be unicode, like α and provides the
* unicode version of it.
*
*@param cell The cell to check for unicode values
*@return translated to unicode
*/
public static Cell translateUnicodeValues(Cell cell) {
String s = cell.getRichStringCellValue().getString();
boolean foundUnicode = false;
String lowerCaseStr = s.toLowerCase(Locale.ROOT);
for (UnicodeMapping entry : unicodeMappings) {
String key = entry.entityName;
if (lowerCaseStr.contains(key)) {
s = s.replaceAll(key, entry.resolvedValue);
foundUnicode = true;
}
}
if (foundUnicode) {
cell.setCellValue(cell.getRow().getSheet().getWorkbook().getCreationHelper()
.createRichTextString(s));
}
return cell;
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Remove the Cell from this row.
*
* @param cell the cell to remove
*/
@Override
public void removeCell(Cell cell) {
if (cell.getRow() != this) {
throw new IllegalArgumentException("Specified cell does not belong to this row");
}
XSSFCell xcell = (XSSFCell)cell;
if(xcell.isPartOfArrayFormulaGroup()) {
xcell.notifyArrayFormulaChanging();
}
if(cell.getCellType() == CellType.FORMULA) {
_sheet.getWorkbook().onDeleteFormula(xcell);
}
// Performance optimization for bug 57840: explicit boxing is slightly faster than auto-unboxing, though may use more memory
final Integer colI = Integer.valueOf(cell.getColumnIndex()); // NOSONAR
_cells.remove(colI);
}
代码示例来源:origin: org.apache.poi/poi
/**
* Creates a cell, gives it a value, and applies a style if provided
*
* @param row the row to create the cell in
* @param column the column index to create the cell in
* @param value The value of the cell
* @param style If the style is not null, then set
* @return A new Cell
*/
public static Cell createCell(Row row, int column, String value, CellStyle style) {
Cell cell = getCell(row, column);
cell.setCellValue(cell.getRow().getSheet().getWorkbook().getCreationHelper()
.createRichTextString(value));
if (style != null) {
cell.setCellStyle(style);
}
return cell;
}
代码示例来源:origin: org.apache.poi/poi
Sheet sheet = cell.getSheet();
Workbook wb = sheet.getWorkbook();
Row row = cell.getRow();
int column = cell.getColumnIndex();
代码示例来源:origin: com.phloc/phloc-poi
public void goTo (final Cell aCell)
{
goTo (aCell.getRow ());
this.m_aLastCell = aCell;
}
代码示例来源:origin: org.optaplanner/optaplanner-examples
protected long readLongCell(Cell cell) {
double d = cell.getNumericCellValue();
long l = (long) d;
if (d - (double) l != 0.0) {
throw new IllegalArgumentException("The keyCell (" + cell.getRow().getRowNum() + ","
+ cell.getColumnIndex() + ") with value (" + d + ") is expected to be a long.");
}
return l;
}
代码示例来源:origin: org.optaplanner/optaplanner-examples
protected double readDoubleParameter(Row row, String key) {
Cell keyCell = row.getCell(0);
if (!key.equals(keyCell.getStringCellValue())) {
throw new IllegalArgumentException("The keyCell (" + keyCell.getRow().getRowNum() + ","
+ keyCell.getColumnIndex() + ") with value (" + keyCell.getStringCellValue()
+ ") is expected to have the key (" + key + ")");
}
Cell valueCell = row.getCell(1);
return valueCell.getNumericCellValue();
}
}
代码示例来源:origin: org.optaplanner/optaplanner-examples
protected String readStringParameter(Row row, String key) {
Cell keyCell = row.getCell(0);
if (!key.equals(keyCell.getStringCellValue())) {
throw new IllegalArgumentException("The keyCell (" + keyCell.getRow().getRowNum() + ","
+ keyCell.getColumnIndex() + ") with value (" + keyCell.getStringCellValue()
+ ") is expected to have the key (" + key + ")");
}
Cell valueCell = row.getCell(1);
return valueCell.getStringCellValue();
}
代码示例来源:origin: org.optaplanner/optaplanner-examples
protected void assertCellConstant(Cell cell, String constant) {
if (!constant.equals(cell.getStringCellValue())) {
throw new IllegalArgumentException("The cell (" + cell.getRow().getRowNum() + ","
+ cell.getColumnIndex() + ") with value (" + cell.getStringCellValue()
+ ") is expected to have the constant (" + constant + ")");
}
}
代码示例来源:origin: org.jeecg/easypoi-base
@Override
public void convertToExcel(Cell cell, CellStyle cellStyle, CellStyleEntity style) {
if (StringUtils.isNoneBlank(style.getHeight())) {
int height = Math.round(PoiCssUtils.getInt(style.getHeight()) * 255 / 12.75F);
Row row = cell.getRow();
if (height > row.getHeight()) {
row.setHeight((short) height);
}
}
}
代码示例来源:origin: cn.afterturn/easypoi-base
@Override
public void convertToExcel(Cell cell, CellStyle cellStyle, CellStyleEntity style) {
if (StringUtils.isNoneBlank(style.getHeight())) {
int height = Math.round(PoiCssUtils.getInt(style.getHeight()) * 255 / 12.75F);
Row row = cell.getRow();
if (height > row.getHeight()) {
row.setHeight((short) height);
}
}
}
代码示例来源:origin: org.osgl/osgl-excel
public Object readErrorCell(Cell cell) {
if (isStrict()) {
throw new ExcelReadException("Error cell value encountered: %s@[%s]", cell.getAddress(), cell.getRow().getSheet().getSheetName());
}
return null;
}
代码示例来源:origin: org.osgl/osgl-excel
public Object readUnknownCellType(Cell cell) {
if (isStrict()) {
throw new ExcelReadException("Unknown cell type encountered: %s@[%s]", cell.getAddress(), cell.getRow().getSheet().getSheetName());
}
return null;
}
代码示例来源:origin: org.osgl/excel-reader
public void errorSettingCellValueToPojo(Exception e, Cell cell, Object value, Class<?> schema) {
String errorMessage = S.fmt("failed to set cell value[%s] to POJO[%s]: %s@[%s]", value, schema, cell.getAddress(), cell.getRow().getSheet().getSheetName());
if (isStrict()) {
throw new ExcelReadException(e, errorMessage);
}
LOGGER.warn(e, errorMessage);
}
}
代码示例来源:origin: org.osgl/osgl-excel
public void errorSettingCellValueToPojo(Exception e, Cell cell, Object value, Class<?> schema) {
String errorMessage = S.fmt("failed to set cell value[%s] to POJO[%s]: %s@[%s]", value, schema, cell.getAddress(), cell.getRow().getSheet().getSheetName());
if (isStrict()) {
throw new ExcelReadException(e, errorMessage);
}
LOGGER.warn(e, errorMessage);
}
}
内容来源于网络,如有侵权,请联系作者删除!