CGXRange::ExpandRange

CGXRange& ExpandRange(ROWCOL nFirstRow, ROWCOL nFirstCol, ROWCOL nRowCount, ROWCOL nColCount);

Return Value

Returns a reference to this object.

Remarks

Expands the range to a given grid dimension if the range is a range of columns, rows, or the whole table.

If you have a range of rows or the full table, the left and right values are 0 (as explained in SetTable() and SetRows()). When calling ExpandRange, the range will be converted to a range of cells with the left column equal to nFirstCol and the right column equal to nColCount.

If you have a range of columns or the full table, the top and bottom values are 0 (as explained in SetTable() and SetCols()). When calling ExpandRange, the range will be converted to a range of cells with the top row equal to nFirstRow and the bottom row equal to nRowCount.

Example

This example shows how to loop through the list of selection and expand ranges with ExpandRange.

   // Determine list of ranges
   CGXRangeList selList;
   if (!CopyRangeList(selList, TRUE))
      return;
   // loop through selected cells
   POSITION pos = selList.GetHeadPosition();
   while (pos)
   {
      CGXRange range = selList.GetNext(pos);
      range.ExpandRange(1, 1, nRowCount, nColCount);
         // Now, I can be sure that
         // range.top, range.left, range.bottom and range.right
         // contain values greater than 0.
   }

See Also

 CGXRange::IsCells  CGXRange::IsCols  CGXRange::IsRows  CGXRange::IsTable

CGXRange

 Class Overview |  Class Members