示例#1
0
        public void TestToFormulaString()
        {
            Ref3DPtg target = new Ref3DPtg("A1", (short)0);

            HSSFWorkbook wb = CreateWorkbookWithSheet("my sheet");
            HSSFEvaluationWorkbook book = HSSFEvaluationWorkbook.Create(wb);
            Assert.AreEqual("'my sheet'!A1", target.ToFormulaString(book));

            wb.SetSheetName(0, "ProfitAndLoss");
            Assert.AreEqual("ProfitAndLoss!A1", target.ToFormulaString(book));

            wb.SetSheetName(0, "profit+loss");
            Assert.AreEqual("'profit+loss'!A1", target.ToFormulaString(book));
        }
示例#2
0
 public MockRefEval(Ref3DPtg ptg, ValueEval value)
     : base(-1, -1, ptg.Row, ptg.Column)
 {
     _value = value;
 }
示例#3
0
        /**
 *
 * @param sheetIden may be <code>null</code>
 * @param part1
 * @param part2 may be <code>null</code>
 */
        private ParseNode CreateAreaRefParseNode(SheetIdentifier sheetIden, SimpleRangePart part1,
                SimpleRangePart part2)
        {

            int extIx;
            if (sheetIden == null)
            {
                extIx = Int32.MinValue;
            }
            else
            {
                String sName = sheetIden.SheetID.Name;
                if (sheetIden.BookName == null)
                {
                    extIx = _book.GetExternalSheetIndex(sName);
                }
                else
                {
                    extIx = _book.GetExternalSheetIndex(sheetIden.BookName, sName);
                }
            }
            Ptg ptg;
            if (part2 == null)
            {
                CellReference cr = part1.getCellReference();
                if (sheetIden == null)
                {
                    ptg = new RefPtg(cr);
                }
                else
                {
                    ptg = new Ref3DPtg(cr, extIx);
                }
            }
            else
            {
                AreaReference areaRef = CreateAreaRef(part1, part2);

                if (sheetIden == null)
                {
                    ptg = new AreaPtg(areaRef);
                }
                else
                {
                    ptg = new Area3DPtg(areaRef, extIx);
                }
            }
            return new ParseNode(ptg);
        }
示例#4
0
        public LazyRefEval(Ref3DPtg ptg, SheetRefEvaluator sre)
            : base(ptg.Row, ptg.Column)
        {

            _evaluator = sre;
        }
 public ValueEval GetRef3DEval(Ref3DPtg rptg)
 {
     SheetRangeEvaluator sre = CreateExternSheetRefEvaluator(rptg.ExternSheetIndex);
     return new LazyRefEval(rptg.Row, rptg.Column, sre);
 }