本文整理匯總了C#中NPOI.SS.Util.CellReference.Equals方法的典型用法代碼示例。如果您正苦於以下問題:C# CellReference.Equals方法的具體用法?C# CellReference.Equals怎麽用?C# CellReference.Equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NPOI.SS.Util.CellReference
的用法示例。
在下文中一共展示了CellReference.Equals方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FormatAsString
/**
* @return the text format of this range using specified sheet name.
*/
public String FormatAsString(String sheetName, bool useAbsoluteAddress)
{
StringBuilder sb = new StringBuilder();
if (sheetName != null)
{
sb.Append(SheetNameFormatter.Format(sheetName));
sb.Append("!");
}
CellReference cellRefFrom = new CellReference(FirstRow, FirstColumn,
useAbsoluteAddress, useAbsoluteAddress);
CellReference cellRefTo = new CellReference(LastRow, LastColumn,
useAbsoluteAddress, useAbsoluteAddress);
sb.Append(cellRefFrom.FormatAsString());
//for a single-cell reference return A1 instead of A1:A1
//for full-column ranges or full-row ranges return A:A instead of A,
//and 1:1 instead of 1
if (!cellRefFrom.Equals(cellRefTo)
|| IsFullColumnRange || IsFullRowRange)
{
sb.Append(':');
sb.Append(cellRefTo.FormatAsString());
}
return sb.ToString();
}
示例2: Process
private static void Process(IRow row, HSSFFormulaEvaluator eval)
{
IEnumerator it = row.GetEnumerator();
while (it.MoveNext())
{
ICell cell = (ICell)it.Current;
if (cell.CellType != NPOI.SS.UserModel.CellType.FORMULA)
{
continue;
}
FormulaRecordAggregate record = (FormulaRecordAggregate)((HSSFCell)cell).CellValueRecord;
FormulaRecord r = record.FormulaRecord;
Ptg[] ptgs = r.ParsedExpression;
String cellRef = new CellReference(row.RowNum, cell.ColumnIndex, false, false).FormatAsString();
#if !HIDE_UNREACHABLE_CODE
if (false && cellRef.Equals("BP24"))
{
Console.Write(cellRef);
Console.WriteLine(" - has " + ptgs.Length + " ptgs:");
for (int i = 0; i < ptgs.Length; i++)
{
String c = ptgs[i].GetType().ToString();
Console.WriteLine("\t" + c.Substring(c.LastIndexOf('.') + 1));
}
Console.WriteLine("-> " + cell.CellFormula);
}
#endif
NPOI.SS.UserModel.CellValue evalResult = eval.Evaluate(cell);
Assert.IsNotNull(evalResult);
}
}
示例3: FormatAsString
public String FormatAsString()
{
StringBuilder sb = new StringBuilder();
CellReference cellRefFrom = new CellReference(FirstRow, FirstColumn);
CellReference cellRefTo = new CellReference(LastRow, LastColumn);
sb.Append(cellRefFrom.FormatAsString());
if (!cellRefFrom.Equals(cellRefTo))
{
sb.Append(':');
sb.Append(cellRefTo.FormatAsString());
}
return sb.ToString();
}