///
///
int FirstRowNum { get; }
/// <summary>
/// Gets the last row on the sheet
/// </summary>
/// <value>last row contained n this sheet (0-based)</value>
int LastRowNum { get; }
///
///
short FirstCellNum { get; }
/// <summary>
/// Gets the index of the last cell Contained in this row <b>PLUS ONE</b>. The result also
/// happens to be the 1-based column number of the last cell. This value can be used as a
/// standard upper bound when iterating over cells:
/// <pre>
/// short minColIx = row.GetFirstCellNum();
/// short maxColIx = row.GetLastCellNum();
/// for(short colIx=minColIx; colIx<maxColIx; colIx++) {
/// Cell cell = row.GetCell(colIx);
/// if(cell == null) {
/// continue;
/// }
/// //... do something with cell
/// }
/// </pre>
/// </summary>
/// <returns>
/// short representing the last logical cell in the row <b>PLUS ONE</b>,
/// or -1 if the row does not contain any cells.
/// </returns>
short LastCellNum { get; }
Excel2003
HSSFWorkbook
D:\ChuckLu\Git\GitHub\Other\npoi\main\HSSF\UserModel\HSSFCell.cs
///
public override String ToString()
{
switch (CellType)
{
case CellType.Blank:
return "";
case CellType.Boolean:
return BooleanCellValue ? "TRUE" : "FALSE";
case CellType.Error:
return NPOI.SS.Formula.Eval.ErrorEval.GetText(((BoolErrRecord)_record).ErrorValue);
case CellType.Formula:
return CellFormula;
case CellType.Numeric:
string format = this.CellStyle.GetDataFormatString();
DataFormatter formatter = new DataFormatter();
return formatter.FormatCellValue(this);
case CellType.String:
return StringCellValue;
default:
return "Unknown Cell Type: " + CellType;
}
}
Excel2007
XSSFWorkbook
D:\ChuckLu\Git\GitHub\Other\npoi\ooxml\XSSF\UserModel\XSSFCell.cs
///
///
public override String ToString()
{
switch (CellType)
{
case CellType.Blank:
return "";
case CellType.Boolean:
return BooleanCellValue ? "TRUE" : "FALSE";
case CellType.Error:
return ErrorEval.GetText(ErrorCellValue);
case CellType.Formula:
return CellFormula;
case CellType.Numeric:
if (DateUtil.IsCellDateFormatted(this))
{
FormatBase sdf = new SimpleDateFormat("dd-MMM-yyyy");
return sdf.Format(DateCellValue, CultureInfo.CurrentCulture);
}
return NumericCellValue.ToString();
case CellType.String:
return RichStringCellValue.ToString();
default:
return "Unknown Cell Type: " + CellType;
}
}
手机扫一扫
移动阅读更方便
你可能感兴趣的文章