Format and Modify Named Ranges
Setting Background Color and Font Attributes to a Named Range
The following example shows how to set the solid fill color (shading color) with font settings to a range.
Adding Borders to a Named Range
It is possible to add borders to a range of cells instead of just a single cell. The Range object provides a SetOutlineBorder method that takes the following parameters to add a border to the range of cells:
- Border type, the type of border, selected from the BorderType enumeration.
- Line style, the line style, selected from the CellBorderType enumeration.
- Color, the line color, selected from the Color enumeration.
The following example shows how to set an outline border to a range.
The following example shows how to set borders around each cell in the range.
Rename a Named Range
Aspose.Cells allows you to rename a named range for your need. You may get the named range and rename it by using Name.Text attribute. The following example shows how to rename a named range.
Union of Ranges
Intersection of Ranges
Aspose.Cells provides the Range.Intersect method to intersect two ranges. The method returns a Range object. To check whether a range intersects another range, use the Range.Intersect method that returns a Boolean value. The following example shows how to intersect the ranges.
Merge Cells in the Named Range
Aspose.Cells provides Range.Merge() method to merge the cells in the range. The following example shows how to merge the individual cells of a named range.
Remove a Named Range
Aspose.Cells provides the NameCollection.RemoveAt() method to erase the name of the range. To clear the contents of the range, use Cells.ClearRange() method. The following example shows how to remove a named range with its contents.