示例#1
0
        /// <summary>
        /// Initializes a Range made up of cells, based on a range string
        /// like "A1" or "B2:LC65536".
        /// </summary>
        public Range(
            string rangeString,
            Worksheet worksheet,
            SLDocument document
            )
        {
            this._document  = document;
            this._worksheet = worksheet;
            this._type      = RangeType.Cells;

            (_minRowIndex, _minColIndex, _maxRowIndex, _maxColIndex) =
                CoordinateUtils.RangeStringToCoords(rangeString);
        }
示例#2
0
 /// <summary>
 /// Returns a Range object matching the specified range string, but relative to
 /// the top left corner of this Range. The Microsoft Excel equivalent of this
 /// method is Range.Range.
 /// </summary>
 /// <param name="rangeString">
 /// For example, "A2:IV65536" or "B3"
 /// </param>
 public Range RelativeRange(string rangeString)
 {
     (
         int relMinRowIndex,
         int relMinColIndex,
         int relMaxRowIndex,
         int relMaxColIndex
     ) = CoordinateUtils.RangeStringToCoords(rangeString);
     return(new Range(
                this._minRowIndex + relMinRowIndex - 1,
                this._minColIndex + relMinColIndex - 1,
                this._minRowIndex + relMaxRowIndex - 1,
                this._minColIndex + relMaxColIndex - 1,
                this._type,
                this._worksheet,
                this._document
                ));
 }