Get Started
Documentation

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

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.

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.

GetValue

Set cell value

GetWorksheet

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

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

Set columns width value

SetFillColor

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

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");
var 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