Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
The following steps describe how to name a cell or range of cells using Microsoft Excel. This method applies to Microsoft Office Excel 2003, Microsoft Excel 97, 2000, and 2002.
Here, we use the Aspose.Cells API to do the task.
Aspose.Cells provides a class, Workbook, that represents a Microsoft Excel file. The Workbook class contains a WorksheetCollection that allows access to each worksheet in an Excel file. A worksheet is represented by the Worksheet class. The Worksheet class provides a Cells collection.
It is possible to create a named range by calling the overloaded createRange method of the Cells collection. A typical version of the createRange method takes the following parameters:
When the createRange method is called, it returns the newly created named range as an instance of Range class.
The following example shows how to create a named range of cells that extends over B4:G14.
Call the getNamedRanges method of the WorksheetCollection to get all named ranges in a spreadsheet. The getNamedRanges method returns an array of all named ranges in the WorksheetCollection.
The following example shows how to access all the named ranges in a workbook.
Call the WorksheetCollection collection’s getRangeByName method to get a specified range by name. A typical getRangeByName method takes the name of the named range and returns the specified named range as an instance of the Range class.
The following example shows how to access a specified range by its name.
Using Aspose.Cells, you can insert data into the individual cells of a range. Suppose, you have a named range of cells.i.e., A1:C4. So the matrix would make 4 * 3 = 12 cells and the individual range cells are arranged sequentially. Aspose.Cells provides you some useful Properties of Range class to access the individual cells in the range. You may use the following methods to identify the cells in the range:
The following example shows how to input some values into the cells of a specified range.
Using Aspose.Cells, you can insert data into the individual cells of a range. Suppose, you have a named range of cells i.e., H1:J4. So the matrix would make 4 * 3 = 12 cells and the individual range cells are arranged sequentially. Aspose.Cells provides you some useful Properties of Range class to access the individual cells in the range. You may use the following properties to identify the cells in the range:
The following example shows how to input some values into the cells of a specified range.
To apply formatting, define a Style object to specify style settings and apply it to the Range object.
The following example shows how to set solid fill color (shading color) with font settings to a range.
It is possible to add borders to a range of cells instead of just a single cell. The Range object provides a setOutlineBorders method that takes the following parameters to add a border to the range of cells:
The following example shows how to set an outline border to a range.
The following output would be generated after executing the above code:

Sometimes, you want to create apply a style to the cells in a Range. For this, you may iterate over the cells in the range and use the Cell.setStyle method to apply the style to the cell.
The following example shows how to apply styles to cells in a 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.
borderColors
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.