Ejemplo n.º 1
0
        /// <summary> Constructs this object from a string
        ///
        /// </summary>
        /// <param name="s">the string
        /// </param>
        /// <param name="w">the external sheet
        /// </param>
        /// <exception cref=""> FormulaException
        /// </exception>
        public CellReference3d(string s, ExternalSheet w)
        {
            workbook       = w;
            columnRelative = true;
            rowRelative    = true;

            // Get the cell details
            int    sep        = s.IndexOf((System.Char) '!');
            string cellString = s.Substring(sep + 1);

            column = CellReferenceHelper.getColumn(cellString);
            row    = CellReferenceHelper.getRow(cellString);

            // Get the sheet index
            string sheetName = s.Substring(0, (sep) - (0));

            // Remove single quotes, if they exist
            if (sheetName[0] == '\'' && sheetName[sheetName.Length - 1] == '\'')
            {
                sheetName = sheetName.Substring(1, (sheetName.Length - 1) - (1));
            }
            sheet = w.getExternalSheetIndex(sheetName);

            if (sheet < 0)
            {
                throw new FormulaException(FormulaException.sheetRefNotFound, sheetName);
            }
        }
Ejemplo n.º 2
0
        /**
         * Constructor invoked when parsing a string formula
         *
         * @param s the string to parse
         * @param es the external sheet
         * @exception FormulaException
         */
        public ColumnRange3d(string s, ExternalSheet es)
            : base(es)
        {
            workbook = es;
            int seppos = s.LastIndexOf(":");

            Assert.verify(seppos != -1);
            string startcell = s.Substring(0, seppos);
            string endcell   = s.Substring(seppos + 1);

            // Get the the start cell details
            int    sep         = s.IndexOf('!');
            string cellString  = s.Substring(sep + 1, seppos);
            int    columnFirst = CellReferenceHelper.getColumn(cellString);
            int    rowFirst    = 0;

            // Get the sheet index
            string sheetName    = s.Substring(0, sep);
            int    sheetNamePos = sheetName.LastIndexOf(']');

            // Remove single quotes, if they exist
            if (sheetName[0] == '\'' &&
                sheetName[sheetName.Length - 1] == '\'')
            {
                sheetName = sheetName.Substring(1, sheetName.Length - 1);
            }

            sheet = es.getExternalSheetIndex(sheetName);

            if (sheet < 0)
            {
                throw new FormulaException(FormulaException.SHEET_REF_NOT_FOUND, sheetName);
            }

            // Get the last cell index
            int columnLast = CellReferenceHelper.getColumn(endcell);
            int rowLast    = 0xffff;

            bool columnFirstRelative = true;
            bool rowFirstRelative    = true;
            bool columnLastRelative  = true;
            bool rowLastRelative     = true;

            setRangeData(sheet, columnFirst, columnLast, rowFirst, rowLast,
                         columnFirstRelative, rowFirstRelative,
                         columnLastRelative, rowLastRelative);
        }
Ejemplo n.º 3
0
        /// <summary> Constructor invoked when parsing a string formula
        ///
        /// </summary>
        /// <param name="s">the string to parse
        /// </param>
        internal Area3d(string s, ExternalSheet es)
        {
            workbook = es;
            int seppos = s.IndexOf(":");

            Assert.verify(seppos != -1);
            //    String startcell = s.substring(0, seppos);
            string endcell = s.Substring(seppos + 1);

            // Get the the start cell details
            int    sep        = s.IndexOf((System.Char) '!');
            string cellString = s.Substring(sep + 1, (seppos) - (sep + 1));

            columnFirst = CellReferenceHelper.getColumn(cellString);
            rowFirst    = CellReferenceHelper.getRow(cellString);

            // Get the sheet index
            string sheetName = s.Substring(0, (sep) - (0));

            // Remove single quotes, if they exist
            if (sheetName[0] == '\'' && sheetName[sheetName.Length - 1] == '\'')
            {
                sheetName = sheetName.Substring(1, (sheetName.Length - 1) - (1));
            }
            sheet = es.getExternalSheetIndex(sheetName);

            if (sheet < 0)
            {
                throw new FormulaException(FormulaException.sheetRefNotFound, sheetName);
            }

            // Get the last cell index
            columnLast = CellReferenceHelper.getColumn(endcell);
            rowLast    = CellReferenceHelper.getRow(endcell);

            columnFirstRelative = true;
            rowFirstRelative    = true;
            columnLastRelative  = true;
            rowLastRelative     = true;
        }
        /**
         * Constructs this object from a string
         *
         * @param s the string
         * @param w the external sheet
         * @exception FormulaException
         */
        public CellReference3d(string s,ExternalSheet w)
        {
            workbook = w;
            columnRelative = true;
            rowRelative = true;

            // Get the cell details
            int sep = s.IndexOf('!');
            string cellString = s.Substring(sep + 1);
            column = CellReferenceHelper.getColumn(cellString);
            row = CellReferenceHelper.getRow(cellString);

            // Get the sheet index
            string sheetName = s.Substring(0,sep);

            // Remove single quotes, if they exist
            if (sheetName[0] == '\'' && sheetName[sheetName.Length - 1] == '\'')
                sheetName = sheetName.Substring(1,sheetName.Length - 1);
            sheet = w.getExternalSheetIndex(sheetName);

            if (sheet < 0)
                throw new FormulaException(FormulaException.SHEET_REF_NOT_FOUND,sheetName);
        }
Ejemplo n.º 5
0
        /**
         * Constructor invoked when parsing a string formula
         *
         * @param s the string to parse
         * @param es the external sheet
         * @exception FormulaException
         */
        public Area3d(string s, ExternalSheet es)
        {
            workbook = es;
            int seppos = s.LastIndexOf(":");
            Assert.verify(seppos != -1);
            string endcell = s.Substring(seppos + 1);

            // Get the the start cell details
            int sep = s.IndexOf('!');
            string cellString = s.Substring(sep + 1,seppos);
            columnFirst = CellReferenceHelper.getColumn(cellString);
            rowFirst = CellReferenceHelper.getRow(cellString);

            // Get the sheet index
            string sheetName = s.Substring(0,sep);

            // Remove single quotes, if they exist
            if (sheetName[0] == '\'' &&
                sheetName[sheetName.Length - 1] == '\'')
                {
                sheetName = sheetName.Substring(1,sheetName.Length - 1);
                }

            sheet = es.getExternalSheetIndex(sheetName);

            if (sheet < 0)
                {
                throw new FormulaException(FormulaException.SHEET_REF_NOT_FOUND,
                                           sheetName);
                }

            // Get the last cell index
            columnLast = CellReferenceHelper.getColumn(endcell);
            rowLast = CellReferenceHelper.getRow(endcell);

            columnFirstRelative = true;
            rowFirstRelative = true;
            columnLastRelative = true;
            rowLastRelative = true;
        }