當前位置: 首頁>>代碼示例>>C#>>正文


C# CellReference.Equals方法代碼示例

本文整理匯總了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();
        }
開發者ID:WPG,項目名稱:npoi,代碼行數:28,代碼來源:CellRangeAddress.cs

示例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);
            }
        }
開發者ID:hanwangkun,項目名稱:npoi,代碼行數:33,代碼來源:TestBug42464.cs

示例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();
 }
開發者ID:babywzazy,項目名稱:Server,代碼行數:13,代碼來源:CellRangeAddress.cs


注:本文中的NPOI.SS.Util.CellReference.Equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。