本文整理汇总了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();
}