Exemplo n.º 1
0
 private static AreaReference CreateAreaRef(SimpleRangePart part1, SimpleRangePart part2)
 {
     if (!part1.IsCompatibleForArea(part2))
     {
         throw new FormulaParseException("has incompatible parts: '"
                 + part1.Rep + "' and '" + part2.Rep + "'.");
     }
     if (part1.IsRow)
     {
         return AreaReference.GetWholeRow(part1.Rep, part2.Rep);
     }
     if (part1.IsColumn)
     {
         return AreaReference.GetWholeColumn(part1.Rep, part2.Rep);
     }
     return new AreaReference(part1.getCellReference(), part2.getCellReference());
 }
Exemplo n.º 2
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);
        }