Esempio n. 1
0
        public string ToString(XLReferenceStyle referenceStyle, bool includeSheet)
        {
            string address;

            if (!IsValid)
            {
                address = "#REF!";
            }
            else if (referenceStyle == XLReferenceStyle.A1)
            {
                address = GetTrimmedAddress();
            }
            else if (referenceStyle == XLReferenceStyle.R1C1 ||
                     HasWorksheet && Worksheet.Workbook.ReferenceStyle == XLReferenceStyle.R1C1)
            {
                address = "R" + _rowNumber.ToInvariantString() + "C" + ColumnNumber.ToInvariantString();
            }
            else
            {
                address = GetTrimmedAddress();
            }

            if (includeSheet)
            {
                return(String.Concat(
                           WorksheetIsDeleted ? "#REF" : Worksheet.Name.EscapeSheetName(),
                           '!',
                           address));
            }

            return(address);
        }
Esempio n. 2
0
        public String ToStringFixed(XLReferenceStyle referenceStyle, Boolean includeSheet)
        {
            String address;

            if (referenceStyle == XLReferenceStyle.A1)
            {
                address = String.Format("${0}${1}", ColumnLetter, _rowNumber.ToInvariantString());
            }
            else if (referenceStyle == XLReferenceStyle.R1C1)
            {
                address = String.Format("R{0}C{1}", _rowNumber.ToInvariantString(), ColumnNumber);
            }
            else if (HasWorksheet && Worksheet.Workbook.ReferenceStyle == XLReferenceStyle.R1C1)
            {
                address = String.Format("R{0}C{1}", _rowNumber.ToInvariantString(), ColumnNumber);
            }
            else
            {
                address = String.Format("${0}${1}", ColumnLetter, _rowNumber.ToInvariantString());
            }

            if (includeSheet)
            {
                return(String.Format("'{0}'!{1}",
                                     Worksheet.Name,
                                     address));
            }

            return(address);
        }
Esempio n. 3
0
        public string ToString(XLReferenceStyle referenceStyle, bool includeSheet)
        {
            string address = string.Empty;

            if (referenceStyle == XLReferenceStyle.A1)
            {
                address = ColumnLetter + _rowNumber.ToInvariantString();
            }
            else if (referenceStyle == XLReferenceStyle.R1C1)
            {
                address = String.Format("R{0}C{1}", _rowNumber.ToInvariantString(), ColumnNumber);
            }
            else if (HasWorksheet && Worksheet.Workbook.ReferenceStyle == XLReferenceStyle.R1C1)
            {
                address = String.Format("R{0}C{1}", _rowNumber.ToInvariantString(), ColumnNumber);
            }
            else
            {
                address = ColumnLetter + _rowNumber.ToInvariantString();
            }

            if (includeSheet)
            {
                return(String.Format("{0}!{1}",
                                     Worksheet.Name.WrapSheetNameInQuotesIfRequired(),
                                     address));
            }

            return(address);
        }
Esempio n. 4
0
 public string ToString(XLReferenceStyle referenceStyle, bool includeSheet)
 {
     if (referenceStyle == XLReferenceStyle.R1C1)
     {
         return(ToStringFixed(referenceStyle, true));
     }
     else
     {
         return(ToStringRelative(includeSheet));
     }
 }
Esempio n. 5
0
        public String ToStringFixed(XLReferenceStyle referenceStyle, Boolean includeSheet)
        {
            if (includeSheet)
            {
                return(String.Format("'{0}'!{1}:{2}",
                                     Worksheet.Name,
                                     _firstAddress.ToStringFixed(referenceStyle),
                                     _lastAddress.ToStringFixed(referenceStyle)));
            }

            return(_firstAddress.ToStringFixed(referenceStyle) + ":" + _lastAddress.ToStringFixed(referenceStyle));
        }
Esempio n. 6
0
        public String ToStringFixed(XLReferenceStyle referenceStyle, Boolean includeSheet)
        {
            if (includeSheet)
            {
                return(String.Format("{0}!{1}:{2}",
                                     Worksheet.Name.WrapSheetNameInQuotesIfRequired(),
                                     _firstAddress.ToStringFixed(referenceStyle),
                                     _lastAddress.ToStringFixed(referenceStyle)));
            }

            return(_firstAddress.ToStringFixed(referenceStyle) + ":" + _lastAddress.ToStringFixed(referenceStyle));
        }
Esempio n. 7
0
 public string ToString(XLReferenceStyle referenceStyle)
 {
     if (referenceStyle == XLReferenceStyle.A1)
     {
         return(ColumnLetter + _rowNumber.ToInvariantString());
     }
     if (referenceStyle == XLReferenceStyle.R1C1)
     {
         return(String.Format("R{0}C{1}", _rowNumber.ToInvariantString(), ColumnNumber));
     }
     if (HasWorksheet && Worksheet.Workbook.ReferenceStyle == XLReferenceStyle.R1C1)
     {
         return(String.Format("R{0}C{1}", _rowNumber.ToInvariantString(), ColumnNumber));
     }
     return(ColumnLetter + _rowNumber.ToInvariantString());
 }
Esempio n. 8
0
        public String ToStringFixed(XLReferenceStyle referenceStyle, Boolean includeSheet)
        {
            String address;

            if (referenceStyle == XLReferenceStyle.Default && HasWorksheet)
            {
                referenceStyle = Worksheet.Workbook.ReferenceStyle;
            }

            if (referenceStyle == XLReferenceStyle.Default)
            {
                referenceStyle = XLReferenceStyle.A1;
            }

            Debug.Assert(referenceStyle != XLReferenceStyle.Default);

            if (!IsValid)
            {
                address = "#REF!";
            }
            else
            {
                switch (referenceStyle)
                {
                case XLReferenceStyle.A1:
                    address = String.Concat('$', ColumnLetter, '$', _rowNumber.ToInvariantString());
                    break;

                case XLReferenceStyle.R1C1:
                    address = String.Concat('R', _rowNumber.ToInvariantString(), 'C', ColumnNumber);
                    break;

                default:
                    throw new NotImplementedException();
                }
            }

            if (includeSheet)
            {
                return(String.Concat(
                           WorksheetIsDeleted ? "#REF" : Worksheet.Name.EscapeSheetName(),
                           '!',
                           address));
            }

            return(address);
        }
Esempio n. 9
0
 public string Address(bool rowAbsolute = true, bool columnAbsolute = true, XLReferenceStyle referenceStyle = XLReferenceStyle.xlA1, bool external = false, Range relativeTo = null)
 {
     return InternalObject.GetType().InvokeMember("Address", System.Reflection.BindingFlags.GetProperty, null, InternalObject, new object[] { rowAbsolute, columnAbsolute, referenceStyle, external, (relativeTo == null) ? System.Reflection.Missing.Value : relativeTo.InternalObject }).ToString();
 }
Esempio n. 10
0
 public String ToStringFixed(XLReferenceStyle referenceStyle)
 {
     return(ToStringFixed(referenceStyle, false));
 }
Esempio n. 11
0
 public string ToString(XLReferenceStyle referenceStyle)
 {
     return(ToString(referenceStyle, false));
 }
        public String ToStringFixed(XLReferenceStyle referenceStyle, Boolean includeSheet)
        {
            if (includeSheet)
                return String.Format("'{0}'!{1}:{2}",
                    Worksheet.Name,
                    _firstAddress.ToStringFixed(referenceStyle),
                    _lastAddress.ToStringFixed(referenceStyle));

            return _firstAddress.ToStringFixed(referenceStyle) + ":" + _lastAddress.ToStringFixed(referenceStyle);           
        }
 public String ToStringFixed(XLReferenceStyle referenceStyle)
 {
     return ToStringFixed(referenceStyle, false);
 }
Esempio n. 14
0
 public string Address(bool rowAbsolute = true, bool columnAbsolute = true, XLReferenceStyle referenceStyle = XLReferenceStyle.xlA1, bool external = false, Range relativeTo = null)
 {
     return(InternalObject.GetType().InvokeMember("Address", System.Reflection.BindingFlags.GetProperty, null, InternalObject, new object[] { rowAbsolute, columnAbsolute, referenceStyle, external, (relativeTo == null) ? System.Reflection.Missing.Value : relativeTo.InternalObject }).ToString());
 }
Esempio n. 15
0
        public String ToStringFixed(XLReferenceStyle referenceStyle, Boolean includeSheet)
        {
            String address;
            if (referenceStyle == XLReferenceStyle.A1)
                address = String.Format("${0}${1}", ColumnLetter, _rowNumber.ToStringLookup());
            else if (referenceStyle == XLReferenceStyle.R1C1)
                address = String.Format("R{0}C{1}", _rowNumber.ToStringLookup(), ColumnNumber);
            else if (HasWorksheet && Worksheet.Workbook.ReferenceStyle == XLReferenceStyle.R1C1)
                address = String.Format("R{0}C{1}", _rowNumber.ToStringLookup(), ColumnNumber);
            else
                address = String.Format("${0}${1}", ColumnLetter, _rowNumber.ToStringLookup());

            if (includeSheet)
                return String.Format("'{0}'!{1}",
                    Worksheet.Name,
                    address);

            return address;
        }
Esempio n. 16
0
 public string ToString(XLReferenceStyle referenceStyle)
 {
     if (referenceStyle == XLReferenceStyle.A1)
     {
         return ColumnLetter + _rowNumber.ToStringLookup();
     }
     if (referenceStyle == XLReferenceStyle.R1C1)
     {
         return String.Format("R{0}C{1}", _rowNumber.ToStringLookup(), ColumnNumber);
     }
     if (HasWorksheet && Worksheet.Workbook.ReferenceStyle == XLReferenceStyle.R1C1)
     {
         return String.Format("R{0}C{1}", _rowNumber.ToStringLookup(), ColumnNumber);
     }
     return ColumnLetter + _rowNumber.ToStringLookup();
 }