Get Started
Usage API

ApiRange

new ApiRange()

Class representing a range.

Methods

Name Description
AddComment

Adds a comment to the range.

Clear

Clears the entire object.

ForEach

The ForEach() method executes a provided function once for each cell

GetAddress

Get cell adress

GetClassType

Get the type of this class.

GetCol

Get the number of the column for the selected cell.

GetColumnWidth

Get columns width value

GetComment

Returns a ApiComment.

GetCount

Get count rows or columns

GetDefName

Returns a ApiName.

GetFillColor

Get the background color for the current cell range

GetFormula

Gets the formula of the first cell in range.

GetHidden

Get hidden value

GetRow

Get the number of the row for the selected cell.

GetRowHeight

Get rows height value

GetRows

Returns a Range object that represents the rows in the specified range.

GetText

Gets the text of the first cell in range.

GetValue

Gets the value of the first cell in range.

GetValue2

Gets the value2 of the first cell in range.

GetWorksheet

Returns a Worksheet object that represents the worksheet containing the specified range. Read-only.

GetWrapText

Returns whether the words in a cell have been wrapped to fit the cell size.

Merge

Merge the selected cell range into a single cell or a cell row.

Select

Selects the object.

SetAlignHorizontal

Set the horizontal alignment of the text in the current cell range.

SetAlignVertical

Set the vertical alignment of the text in the current cell range.

SetBold

Set the bold property to the text characters in the current cell or cell range.

SetBorders

Set the border to the cell/cell range with the parameters specified.

SetColumnWidth

Sets the width of all columns in the specified range. One unit of column width is equal to the width of one character in the Normal style. For proportional fonts, the width of the character 0 (zero) is used.

SetFillColor

Set the background color for the current cell range with the previously created color object. Set 'No Fill' when previously created color object is null

SetFontColor

Set the text color for the current cell range with the previously created color object.

SetFontName

Set the specified font family as the font name for the current cell range.

SetFontSize

Set the font size for the characters of the current cell range.

SetHidden

Set hidden value

SetItalic

Set the italic property to the text characters in the current cell or cell range.

SetNumberFormat

Specifies whether the number in the cell should be treated like number, currency, date, time, etc. or just like text.

SetOffset

Set cell offset

SetRowHeight

Set rows height value

SetStrikeout

Specify that the contents of the cell/cell range are displayed with a single horizontal line through the center of the line.

SetUnderline

Specify that the contents of this cell/cell range are displayed along with a line appearing directly below the character.

SetValue

Set the value for the current cell or a cell range.

SetWrap

Specifies whether the words in the cell must be wrapped to fit the cell size or not.

UnMerge

Split the selected merged cell range into single cells.

Example

Copy code
builder.CreateFile("xlsx");
oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("B1").SetValue("2");
oWorksheet.GetRange("B2").SetValue("2");
oWorksheet.GetRange("A3").SetValue("2x2=");
oWorksheet.GetRange("B3").SetValue("=B1*B2");
builder.SaveFile("xlsx", "ApiRange.xlsx");
builder.CloseFile();

Resulting document