Get Started
Documentation

ApiRange

new ApiRange()

Class representing a range.

Methods

Name Description
GetCol Get the number of the column for the selected cell.
GetRow Get the number of the row for the selected cell.
Merge Merge the selected cell range into a single cell or a cell row.
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.
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 in the RGB format.
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.
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.
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