Interface IXLRangeBase
public interface IXLRangeBase : IXLAddressable
- Inherited Members
- Extension Methods
Properties
FormulaA1
Sets the cells' formula with A1 references.
string FormulaA1 { set; }
Property Value
- string
The formula with A1 references.
FormulaArrayA1
Create an array formula for all cells in the range.
string FormulaArrayA1 { set; }
Property Value
Exceptions
- InvalidOperationException
When the range overlaps with a table, pivot table, merged cells or partially overlaps another array formula.
FormulaR1C1
Sets the cells' formula with R1C1 references.
string FormulaR1C1 { set; }
Property Value
- string
The formula with R1C1 references.
Hyperlinks
IXLHyperlinks Hyperlinks { get; }
Property Value
ShareString
Gets or sets a value indicating whether this cell's text should be shared or not.
bool ShareString { set; }
Property Value
- bool
If false the cell's text will not be shared and stored as an inline value.
Style
IXLStyle Style { get; set; }
Property Value
Value
Sets a value to every cell in this range.
Setter will clear a formula, if the cell contains a formula. If the value is a text that starts with a single quote, setter will prefix the value with a single quote through IncludeQuotePrefix in Excel too and the value of cell is set to to non-quoted text.
XLCellValue Value { set; }
Property Value
Worksheet
IXLWorksheet Worksheet { get; }
Property Value
Methods
AddConditionalFormat()
IXLConditionalFormat AddConditionalFormat()
Returns
AddToNamed(string)
Creates a named range out of this range.
If the named range exists, it will add this range to that named range.
The default scope for the named range is Workbook.
IXLRange AddToNamed(string rangeName)
Parameters
rangeNamestringName of the range.
Returns
AddToNamed(string, XLScope)
Creates a named range out of this range.
If the named range exists, it will add this range to that named range.
Name of the range. The scope for the named range.IXLRange AddToNamed(string rangeName, XLScope scope)
Parameters
Returns
AddToNamed(string, XLScope, string)
Creates a named range out of this range.
If the named range exists, it will add this range to that named range.
Name of the range. The scope for the named range. The comments for the named range.IXLRange AddToNamed(string rangeName, XLScope scope, string comment)
Parameters
Returns
AsRange()
Converts this object to a range.
IXLRange AsRange()
Returns
Cells()
Returns the collection of cells.
IXLCells Cells()
Returns
Cells(bool)
IXLCells Cells(bool usedCellsOnly)
Parameters
usedCellsOnlybool
Returns
Cells(bool, XLCellsUsedOptions)
IXLCells Cells(bool usedCellsOnly, XLCellsUsedOptions options)
Parameters
usedCellsOnlybooloptionsXLCellsUsedOptions
Returns
Cells(Func<IXLCell, bool>)
IXLCells Cells(Func<IXLCell, bool> predicate)
Parameters
Returns
Cells(string)
IXLCells Cells(string cells)
Parameters
cellsstring
Returns
CellsUsed()
Returns the collection of cells that have a value. Formats are ignored.
IXLCells CellsUsed()
Returns
CellsUsed(XLCellsUsedOptions)
Returns the collection of cells that have a value.
IXLCells CellsUsed(XLCellsUsedOptions options)
Parameters
optionsXLCellsUsedOptionsThe options to determine whether a cell is used.
Returns
CellsUsed(XLCellsUsedOptions, Func<IXLCell, bool>)
IXLCells CellsUsed(XLCellsUsedOptions options, Func<IXLCell, bool> predicate)
Parameters
optionsXLCellsUsedOptionspredicateFunc<IXLCell, bool>
Returns
CellsUsed(Func<IXLCell, bool>)
IXLCells CellsUsed(Func<IXLCell, bool> predicate)
Parameters
Returns
Clear(XLClearOptions)
Clears the contents of this range.
IXLRangeBase Clear(XLClearOptions clearOptions = XLClearOptions.All)
Parameters
clearOptionsXLClearOptionsSpecify what you want to clear.
Returns
Contains(IXLCell)
bool Contains(IXLCell cell)
Parameters
cellIXLCell
Returns
Contains(IXLRangeBase)
Determines whether this range contains the specified range (completely).
For partial matches use the range.Intersects method.
bool Contains(IXLRangeBase range)
Parameters
rangeIXLRangeBaseThe range to match.
Returns
- bool
trueif this range contains the specified range; otherwise,false.
Contains(string)
Determines whether this range contains the specified range (completely).
For partial matches use the range.Intersects method.
bool Contains(string rangeAddress)
Parameters
rangeAddressstringThe range address.
Returns
- bool
trueif this range contains the specified range; otherwise,false.
CreateDataValidation()
Creates a new data validation rule for the range, replacing the existing one.
IXLDataValidation CreateDataValidation()
Returns
CreatePivotTable(IXLCell, string)
IXLPivotTable CreatePivotTable(IXLCell targetCell, string name)
Parameters
Returns
DeleteComments()
Deletes the cell comments from this range.
void DeleteComments()
Difference(IXLRangeBase, Func<IXLCell, bool>, Func<IXLCell, bool>)
Returns all cells in the current range that are not in the other range.
IXLCells Difference(IXLRangeBase otherRange, Func<IXLCell, bool> thisRangePredicate = null, Func<IXLCell, bool> otherRangePredicate = null)
Parameters
otherRangeIXLRangeBaseThe other range.
thisRangePredicateFunc<IXLCell, bool>Predicate applied to this range's cells.
otherRangePredicateFunc<IXLCell, bool>Predicate applied to the other range's cells.
Returns
FirstCell()
Returns the first cell of this range.
IXLCell FirstCell()
Returns
FirstCellUsed()
Returns the first non-empty cell with a value of this range. Formats are ignored.
The cell's address is going to be ([First Row with a value], [First Column with a value])
IXLCell FirstCellUsed()
Returns
FirstCellUsed(XLCellsUsedOptions)
Returns the first non-empty cell with a value of this range.
IXLCell FirstCellUsed(XLCellsUsedOptions options)
Parameters
optionsXLCellsUsedOptionsThe options to determine whether a cell is used.
Returns
FirstCellUsed(XLCellsUsedOptions, Func<IXLCell, bool>)
Returns the first non-empty cell with a value of this range.
IXLCell FirstCellUsed(XLCellsUsedOptions options, Func<IXLCell, bool> predicate)
Parameters
optionsXLCellsUsedOptionsThe options to determine whether a cell is used.
predicateFunc<IXLCell, bool>The predicate used to choose cells
Returns
FirstCellUsed(Func<IXLCell, bool>)
IXLCell FirstCellUsed(Func<IXLCell, bool> predicate)
Parameters
Returns
GetDataValidation()
Returns a data validation rule assigned to the range, if any, or creates a new instance of data validation rule if no rule exists.
IXLDataValidation GetDataValidation()
Returns
Grow()
Grows this the current range by one cell to each side
IXLRangeBase Grow()
Returns
Grow(int)
Grows this the current range by the specified number of cells to each side.
IXLRangeBase Grow(int growCount)
Parameters
growCountintThe grow count.
Returns
Intersection(IXLRangeBase, Func<IXLCell, bool>, Func<IXLCell, bool>)
Returns the intersection of this range with another range on the same worksheet.
IXLRangeAddress Intersection(IXLRangeBase otherRange, Func<IXLCell, bool> thisRangePredicate = null, Func<IXLCell, bool> otherRangePredicate = null)
Parameters
otherRangeIXLRangeBaseThe other range.
thisRangePredicateFunc<IXLCell, bool>Predicate applied to this range's cells.
otherRangePredicateFunc<IXLCell, bool>Predicate applied to the other range's cells.
Returns
- IXLRangeAddress
The range address of the intersection
Intersects(IXLRangeBase)
Determines whether this range contains the specified range.
For whole matches use the range.Contains method.
bool Intersects(IXLRangeBase range)
Parameters
rangeIXLRangeBaseThe range to match.
Returns
- bool
trueif this range intersects the specified range; otherwise,false.
Intersects(string)
Determines whether this range intersects the specified range.
For whole matches use the range.Contains method.
bool Intersects(string rangeAddress)
Parameters
rangeAddressstringThe range address.
Returns
- bool
trueif this range intersects the specified range; otherwise,false.
IsEmpty()
bool IsEmpty()
Returns
IsEmpty(XLCellsUsedOptions)
bool IsEmpty(XLCellsUsedOptions options)
Parameters
optionsXLCellsUsedOptions
Returns
IsEntireColumn()
Determines whether range address spans the entire column.
bool IsEntireColumn()
Returns
- bool
trueif is entire column; otherwise,false.
IsEntireRow()
Determines whether range address spans the entire row.
bool IsEntireRow()
Returns
- bool
trueif is entire row; otherwise,false.
IsEntireSheet()
Determines whether the range address spans the entire worksheet.
bool IsEntireSheet()
Returns
- bool
trueif is entire sheet; otherwise,false.
IsMerged()
bool IsMerged()
Returns
LastCell()
Returns the last cell of this range.
IXLCell LastCell()
Returns
LastCellUsed()
Returns the last non-empty cell with a value of this range. Formats are ignored.
The cell's address is going to be ([Last Row with a value], [Last Column with a value])
IXLCell LastCellUsed()
Returns
LastCellUsed(XLCellsUsedOptions)
Returns the last non-empty cell with a value of this range.
IXLCell LastCellUsed(XLCellsUsedOptions options)
Parameters
optionsXLCellsUsedOptionsThe options to determine whether a cell is used.
Returns
LastCellUsed(XLCellsUsedOptions, Func<IXLCell, bool>)
IXLCell LastCellUsed(XLCellsUsedOptions options, Func<IXLCell, bool> predicate)
Parameters
optionsXLCellsUsedOptionspredicateFunc<IXLCell, bool>
Returns
LastCellUsed(Func<IXLCell, bool>)
IXLCell LastCellUsed(Func<IXLCell, bool> predicate)
Parameters
Returns
Merge()
Merges this range. Only the top-left cell will have a value, other values will be blank.
IXLRange Merge()
Returns
Merge(bool)
IXLRange Merge(bool checkIntersect)
Parameters
checkIntersectbool
Returns
Relative(IXLRangeBase, IXLRangeBase)
Returns a range so that its offset from the target base range is equal to the offset of the current range to the source base range. For example, if the current range is D4:E4, the source base range is A1:C3, then the relative range to the target base range B10:D13 is E14:F14
IXLRangeBase Relative(IXLRangeBase sourceBaseRange, IXLRangeBase targetBaseRange)
Parameters
sourceBaseRangeIXLRangeBaseThe source base range.
targetBaseRangeIXLRangeBaseThe target base range.
Returns
- IXLRangeBase
The relative range
Search(string, CompareOptions, bool)
Searches the cells' contents for a given piece of text
IXLCells Search(string searchText, CompareOptions compareOptions = CompareOptions.Ordinal, bool searchFormulae = false)
Parameters
searchTextstringThe search text.
compareOptionsCompareOptionsThe compare options.
searchFormulaeboolif set to
truesearch formulae instead of cell values.
Returns
Select()
void Select()
SetAutoFilter()
IXLAutoFilter SetAutoFilter()
Returns
SetAutoFilter(bool)
IXLAutoFilter SetAutoFilter(bool value)
Parameters
valuebool
Returns
SetDataValidation()
[Obsolete("Use GetDataValidation() to access the existing rule, or CreateDataValidation() to create a new one.")]
IXLDataValidation SetDataValidation()
Returns
SetValue(XLCellValue)
Set value to all cells in the range.
IXLRangeBase SetValue(XLCellValue value)
Parameters
valueXLCellValue
Returns
Shrink()
Shrinks this current range by one cell.
IXLRangeBase Shrink()
Returns
Shrink(int)
Shrinks the current range by the specified number of cells from each side.
IXLRangeBase Shrink(int shrinkCount)
Parameters
shrinkCountintThe shrink count.
Returns
SurroundingCells(Func<IXLCell, bool>)
Returns the set of cells surrounding the current range.
IXLCells SurroundingCells(Func<IXLCell, bool> predicate = null)
Parameters
Returns
Union(IXLRangeBase, Func<IXLCell, bool>, Func<IXLCell, bool>)
Calculates the union of two ranges on the same worksheet.
IXLCells Union(IXLRangeBase otherRange, Func<IXLCell, bool> thisRangePredicate = null, Func<IXLCell, bool> otherRangePredicate = null)
Parameters
otherRangeIXLRangeBaseThe other range.
thisRangePredicateFunc<IXLCell, bool>Predicate applied to this range's cells.
otherRangePredicateFunc<IXLCell, bool>Predicate applied to the other range's cells.
Returns
- IXLCells
The union
Unmerge()
Unmerges this range.
IXLRange Unmerge()