Esempio n. 1
0
        private static string TranslateInternal(RangeComponents er, uint rowStart, uint colStart, int rowDelta, int colDelta, bool followAbsoluteRefs)
        {
            string str            = null;
            string str2           = null;
            bool   exceededBounds = false;
            bool   flag2          = false;

            if (er.Cell1Error != "")
            {
                str = er.Cell1Error;
            }
            else
            {
                RowColumn column = er.Cell1RowColumn;
                str = TranslateInternal(er.Cell1RowDollar, column.Row, er.Cell1ColDollar, column.Column, rowStart, colStart, rowDelta, colDelta, followAbsoluteRefs, out exceededBounds);
            }
            if (er.Cell2 != "")
            {
                if (er.Cell2Error != "")
                {
                    str2 = er.Cell2Error;
                }
                else
                {
                    RowColumn column2 = er.Cell2RowColumn;
                    str2 = TranslateInternal(er.Cell2RowDollar, column2.Row, er.Cell2ColDollar, column2.Column, rowStart, colStart, rowDelta, colDelta, followAbsoluteRefs, out flag2);
                }
            }
            string str3 = "";

            if (er.SheetName != "")
            {
                str3 = str3 + er.EscapedSheetName + "!";
            }
            if (exceededBounds && (flag2 || (str2 == null)))
            {
                return(str3 + "#REF!");
            }
            str3 = str3 + str;
            if (str2 != null)
            {
                str3 = str3 + ":" + str2;
            }
            return(str3);
        }
Esempio n. 2
0
        private static string TranslateInternal(RangeComponents er, uint rowStart, uint colStart, int rowDelta, int colDelta, bool followAbsoluteRefs)
        {
            string newCellRef1 = null;
            string newCellRef2 = null;
            bool   errRef1 = false, errRef2 = false;

            if (true)
            {
                if (er.Cell1Error != "")
                {
                    newCellRef1 = er.Cell1Error;
                }
                else
                {
                    RowColumn rc1 = er.Cell1RowColumn;
                    newCellRef1 = TranslateInternal(
                        er.Cell1RowDollar, rc1.Row,
                        er.Cell1ColDollar, rc1.Column,
                        rowStart, colStart,
                        rowDelta, colDelta,
                        followAbsoluteRefs,
                        out errRef1);
                }
            }

            if (er.Cell2 != "")
            {
                if (er.Cell2Error != "")
                {
                    newCellRef2 = er.Cell2Error;
                }
                else
                {
                    RowColumn rc2 = er.Cell2RowColumn;
                    newCellRef2 = TranslateInternal(
                        er.Cell2RowDollar, rc2.Row,
                        er.Cell2ColDollar, rc2.Column,
                        rowStart, colStart,
                        rowDelta, colDelta,
                        followAbsoluteRefs,
                        out errRef2);
                }
            }

            string newRange = "";

            if (er.SheetName != "")
            {
                newRange += er.EscapedSheetName + "!";
            }
            if (errRef1 && (errRef2 || newCellRef2 == null))
            {
                newRange += "#REF!";
            }
            else
            {
                newRange += newCellRef1;
                if (newCellRef2 != null)
                {
                    newRange += ":" + newCellRef2;
                }
            }

            return(newRange);
        }