Table of Contents

Class XlsRange

Namespace
Spire.Xls.Core.Spreadsheet
Assembly
Spire.XLS.dll
public class XlsRange : XlsObject, ICombinedRange, IXLSRange, IExcelApplication, IEnumerable<IXLSRange>, IEnumerable, IDisposable
Inheritance
XlsRange
Implements
Derived
Inherited Members

Fields

DEF_MAX_HEIGHT

public const double DEF_MAX_HEIGHT = 409.5

Field Value

double

m_book

protected XlsWorkbook m_book

Field Value

XlsWorkbook

m_iBottomRow

protected int m_iBottomRow

Field Value

int

m_iLeftColumn

protected int m_iLeftColumn

Field Value

int

m_iRightColumn

protected int m_iRightColumn

Field Value

int

m_iTopRow

protected int m_iTopRow

Field Value

int

m_style

protected CellBaseStyle m_style

Field Value

CellBaseStyle

Properties

BooleanValue

Returns or sets the bool value of the specified range. The following code illustrates how to access Boolean property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set and get BooleanValue
worksheet.Range[2, 4].BooleanValue = true;
bool boolean = worksheet.Range[2, 4].BooleanValue;
public bool BooleanValue { get; set; }

Property Value

bool

Borders

Returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format). The following code illustrates how to access Borders property of the Range:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["C2"].Text = "Sample";//Set bordersIBorders borders = worksheet["C2"].Borders;//Set line styleborders[BordersLineType.EdgeTop].LineStyle = LineStyleType.Thin;borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thin;//Set border colorborders[BordersLineType.EdgeTop].Color = Color.Red;borders[BordersLineType.EdgeBottom].Color = Color.Red;//Save to fileworkbook.SaveToFile("CellFormats.xlsx");
public IBorders Borders { get; }

Property Value

IBorders

BuiltInStyle

Gets/sets built in style. The following code illustrates how to access BuiltInStyle property:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["C2"].Text = "Sample";

//Set built in style
worksheet["C2"].BuiltInStyle = BuiltInStyles.Accent3;

//Save to file
workbook.SaveToFile("BuiltInStyle.xlsx");
public BuiltInStyles? BuiltInStyle { get; set; }

Property Value

BuiltInStyles?

CellList

Returns a Range object that represents the cells in the specified range. Read-only. The following code illustrates how to access CellList property of the Range:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set text. The content contained by ![CDATA[]] will be expressed as plain textListCellRange cells = worksheet["A1:E8"].CellList;//Do some manipulationsforeach (CellRange Range in cells)    Range.Text = Range.RangeAddressLocal;//Save to fileworkbook.SaveToFile("CellList.xlsx");
public List<CellRange> CellList { get; }

Property Value

List<CellRange>

CellStyleName

Gets/sets name of the style for the current range. The following code illustrates how to access CellStyleName of the specified range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Add and set style
CellStyle style = workbook.Styles.Add("CustomStyle");
worksheet["C2"].Style = style;

//Check Style name
Console.Write(worksheet["C2"].CellStyleName);
public string CellStyleName { get; set; }

Property Value

string

Cells

Returns a Range object that represents the cells in the specified range. Read-only.

[Obsolete("Please use CellList")]
public CellRange[] Cells { get; }

Property Value

CellRange[]

CellsCount

Gets number of cells.

public int CellsCount { get; }

Property Value

int

Column

Returns the number of the first column in the first area in the specified range. The following code illustrates how to access Column property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Get specified column
int firstColumn = worksheet["E1:R3"].Column;
public int Column { get; }

Property Value

int

ColumnCount

Gets number of columns.

public int ColumnCount { get; }

Property Value

int

ColumnGroupLevel

Column group level.

public int ColumnGroupLevel { get; }

Property Value

int

Remarks

-1 - column group is not same. 0 - Not group 1 - 7 - group level.

ColumnWidth

Returns or sets the width of all columns in the specified range. The following code illustrates how to set the width of all columns in the specified range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set the ColumnWidth
worksheet["A1"].Text = "This cell contains sample text";
worksheet["A1"].ColumnWidth = 25;

//Save to file
workbook.SaveToFile("ColumnWidth.xlsx");
public double ColumnWidth { get; set; }

Property Value

double

Columns

For a Range object, returns an array of Range objects that represent the columns in the specified range. The following code illustrates how to access columns:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set columnsIXLSRange[] columns = worksheet["A1:E8"].Columns;//Do some manipulationsforeach (IXLSRange column in columns)  column.Text = column.RangeAddressLocal;//Save to fileworkbook.SaveToFile("Columns.xlsx");
public IXLSRange[] Columns { get; }

Property Value

IXLSRange[]

CombinedAddress

Returns the combined range reference in the language. Read-only String.

public string CombinedAddress { get; }

Property Value

string

CombinedCells

public List<CellRange> CombinedCells { get; }

Property Value

List<CellRange>

Comment

Returns a Comment object that represents the comment associated with the cell in the upper-left corner of the range.

public ICommentShape Comment { get; }

Property Value

ICommentShape

ConditionalFormats

Collection of conditional formats.

[Obsolete("This Property is Obsolete;use XlsWorksheet.ConditionalFormats instead")]
public ConditionalFormats ConditionalFormats { get; }

Property Value

ConditionalFormats

Count

Returns the number of objects in the collection.

public int Count { get; }

Property Value

int

CurrentRegion

Get the range associated with a range.

public IXLSRange CurrentRegion { get; }

Property Value

IXLSRange

DataValidation

Get dataValidation of the sheet. Read Only. The following code illustrates how to access DataValidation property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Data validation for number
IDataValidation validation = worksheet.Range["A3"].DataValidation;
validation.AllowType = CellDataType.Integer;

//Value between 0 to 10
validation.CompareOperator = ValidationComparisonOperator.Between;
validation.Formula1 = "0";
validation.Formula2 = "10";

//Save to file
workbook.SaveToFile("DataValidation.xlsx");
public Validation DataValidation { get; }

Property Value

Validation

DateTimeValue

Gets/sets DateTime value of the range. The following code illustrates how to set and access DateTimeValue property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set and get the DateTimeValue of specified range
worksheet.Range[2, 4].DateTimeValue = DateTime.Now;
DateTime dateTime = worksheet.Range[2, 4].DateTimeValue;

//Save to file
workbook.SaveToFile("DateTimeValue.xlsx");
public DateTime DateTimeValue { get; set; }

Property Value

DateTime

DisplayedText

Gets cell displayed text.

public string DisplayedText { get; }

Property Value

string

EndCell

Returns a Range object that represents the cell at the end of the region that contains the source range.

public IXLSRange EndCell { get; }

Property Value

IXLSRange

EntireColumn

Returns a Range object that represents the entire column (or columns) that contains the specified range. Read-only.

public IXLSRange EntireColumn { get; }

Property Value

IXLSRange

EntireRow

Returns a Range object that represents the entire row (or rows) that contains the specified range. Read-only.

public IXLSRange EntireRow { get; }

Property Value

IXLSRange

EnvalutedValue

Returns the calculated value of a formula. The following code illustrates how to access a calculated value:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Returns the calculated value of a formula using the most current inputs
string calculatedValue = worksheet["C1"].EnvalutedValue;
Console.WriteLine(calculatedValue);
public string EnvalutedValue { get; }

Property Value

string

ErrorValue

Gets or sets error value of this range.

public string ErrorValue { get; set; }

Property Value

string

ExtendedFormatIndex

[CLSCompliant(false)]
public ushort ExtendedFormatIndex { get; set; }

Property Value

ushort

FirstColumn

protected int FirstColumn { get; set; }

Property Value

int

FirstRow

protected int FirstRow { get; set; }

Property Value

int

Formula

Returns or sets the object's formula in A1-style notation and in the language of the macro.

public string Formula { get; set; }

Property Value

string

FormulaArray

Returns or sets the array formula of a range. The following code illustrates how to set and access FormulaArray property of the range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Assign array formula
worksheet.Range["A1:D1"].FormulaArray = "{1,2,3,4}";

//Adding a named range for the range A1 to D1
worksheet.Names.Add("ArrayRange", worksheet.Range["A1:D1"]);

//Assign formula array with named range
worksheet.Range["A2:D2"].FormulaArray = "ArrayRange+100";

//Save to file
workbook.SaveToFile("FormulaArray.xlsx");
public string FormulaArray { get; set; }

Property Value

string

FormulaArrayR1C1

Returns or sets the formula for the object, using R1C1-style notation in the language of the macro

public string FormulaArrayR1C1 { get; set; }

Property Value

string

FormulaBoolValue

Returns the calculated value of the formula as a boolean.

public bool FormulaBoolValue { get; set; }

Property Value

bool

FormulaDateTime

Gets or sets bool value of the formula.

public DateTime FormulaDateTime { get; set; }

Property Value

DateTime

FormulaErrorValue

Gets or sets error value of the formula.

public string FormulaErrorValue { get; set; }

Property Value

string

FormulaNumberValue

Gets or sets double value of the formula.

public double FormulaNumberValue { get; set; }

Property Value

double

FormulaR1C1

Returns or sets the formula for the object, using R1C1-style notation in the language of the macro

public string FormulaR1C1 { get; set; }

Property Value

string

FormulaStringValue

Gets or sets string value of the range.

public string FormulaStringValue { get; set; }

Property Value

string

FormulaValue

Gets formula value.

public object FormulaValue { get; }

Property Value

object

HasBoolean

Indicates whether range contains bool value. The following code illustrates how to set and access HasBoolean property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Assigning Value2 property of the Range
worksheet["A3"].Value2 = false;

//Checking Range types
bool isboolean = worksheet["A3"].HasBoolean;

//Save to file
workbook.SaveToFile("HasBoolean.xlsx");
public bool HasBoolean { get; }

Property Value

bool

HasComment

public bool HasComment { get; }

Property Value

bool

HasConditionFormats

Indicates whether each cell of the range has some conditional formatting.

public bool HasConditionFormats { get; }

Property Value

bool

HasDataValidation

Indicates whether specified range object has data validation. If Range is not single cell, then returns true only if all cells have data validation. Read-only.

public bool HasDataValidation { get; }

Property Value

bool

HasDateTime

Determines if all cells in the range contain datetime. The following code illustrates how to set and access HasDateTime property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Assigning Value2 property of the Range
worksheet["A1"].Value2 = DateTime.Now;

//Checking Range types
bool isDateTime =  worksheet["A1"].HasDateTime;

//Save to file
workbook.SaveToFile("HasDateTime.xlsx");
public bool HasDateTime { get; }

Property Value

bool

HasError

Indicates whether range contains error value.

public bool HasError { get; }

Property Value

bool

HasExternalFormula

Check if the formula in the range has external links. Read-only.

public bool HasExternalFormula { get; }

Property Value

bool

HasFormula

True if all cells in the range contain formulas;

public bool HasFormula { get; }

Property Value

bool

HasFormulaArray

Determines if all cells in the range contain array-entered formula.

public bool HasFormulaArray { get; }

Property Value

bool

HasFormulaBoolValue

Determines if all cells in the range contain formula bool value..

public bool HasFormulaBoolValue { get; }

Property Value

bool

HasFormulaDateTime

Indicates if current range has formula value formatted as DateTime. Read-only.

public bool HasFormulaDateTime { get; }

Property Value

bool

HasFormulaErrorValue

Determines if all cells in the range contain error value.

public bool HasFormulaErrorValue { get; }

Property Value

bool

HasFormulaNumberValue

Indicates whether current range has formula number value.

public bool HasFormulaNumberValue { get; }

Property Value

bool

HasFormulaStringValue

Indicates if the current range has formula string value. Read-only.

public bool HasFormulaStringValue { get; }

Property Value

bool

HasMerged

Indicates whether this range is part of merged range. The following code illustrates how to access HasMerged property:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["A1"].Text = "Sample text in cell";

//Set merge
worksheet["A1:B1"].Merge();

//Check merge
Console.Write(worksheet["A1:B1"].HasMerged);
public bool HasMerged { get; }

Property Value

bool

HasNumber

Determines if any one cell in the range contain number. The following code illustrates how to set and access Value2 property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Assigning Value2 property of the Range
worksheet["A2"].Value2 = 45;

//Checking Range types
bool isNumber =  worksheet["A2"].HasNumber;

//Save to file
workbook.SaveToFile("HasNumber.xlsx");
public bool HasNumber { get; }

Property Value

bool

HasPictures

Indicates whether the range is blank.

public bool HasPictures { get; }

Property Value

bool

HasRichText

Determines if all cells in the range contain rich text string. The following code illustrates how to access HasRichText property:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Create style
IStyle style = workbook.Styles.Add("CustomStyle");

//Set rich text
IRichTextString richText = worksheet["C2"].RichText;
richText.Text = "Sample";
IFont font = style.Font;
font.Color = Color.Red;
richText.SetFont(0, 5, font);

//Check HasRichText
Console.Write(worksheet["C2"].HasRichText);

//Save to file
workbook.SaveToFile("HasRichText.xlsx");
public bool HasRichText { get; }

Property Value

bool

HasString

Determines if all cells in the range contain string.

public bool HasString { get; }

Property Value

bool

HasStyle

Determines if all cells in the range contain differs from default style. The following code illustrates how to access HasStyle property:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Add style
CellStyle style = workbook.Styles.Add("CustomStyle");

//Set color and style
style.Color = Color.Red;
worksheet["C2"].Style = style;

//Check HasStyle
Console.Write(worksheet["C2"].HasStyle);

//Save to file
workbook.SaveToFile("HasStyle.xlsx");
public bool HasStyle { get; }

Property Value

bool

HorizontalAlignment

Returns or sets the horizontal alignment for the specified object. The following code illustrates how to set and access HasStyle property:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["A1"].Text = "Test";

//Set alignment
worksheet["A1"].HorizontalAlignment = HorizontalAlignType.Right;

//Save to file
workbook.SaveToFile("HorizontalAlignment.xlsx");
public HorizontalAlignType HorizontalAlignment { get; set; }

Property Value

HorizontalAlignType

HtmlString

Gets and sets the html string which contains data and some formattings in this cell.

public string HtmlString { get; set; }

Property Value

string

Returns hyperlinks for this range.

public IHyperLinks Hyperlinks { get; }

Property Value

IHyperLinks

IgnoreErrorOptions

Represents ignore error options. If not single cell returs concatenateed flags.

public IgnoreErrorType IgnoreErrorOptions { get; set; }

Property Value

IgnoreErrorType

IndentLevel

Returns or sets the indent level for the cell or range. value should be 0 between 15. The following code illustrates how to set indent level for a cell:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["C2"].Text = "Sample";

//Set indent level
worksheet["C2"].IndentLevel = 2;

//Save to file
workbook.SaveToFile("IndentLevel.xlsx");
public int IndentLevel { get; set; }

Property Value

int

IsAllNumber

Determines if all cells in the range contain number.

public bool IsAllNumber { get; }

Property Value

bool

IsBlank

Indicates whether the range is blank.

public bool IsBlank { get; }

Property Value

bool

IsFormulaHidden

Determines if the formula will be hidden when the worksheet is protected.

public bool IsFormulaHidden { get; set; }

Property Value

bool

IsGroupedByColumn

Indicates whether this range is grouped by column.

public bool IsGroupedByColumn { get; }

Property Value

bool

IsGroupedByRow

Indicates whether this range is grouped by row.

public bool IsGroupedByRow { get; }

Property Value

bool

IsInitialized

Indicates whether range has been initialized.

public bool IsInitialized { get; }

Property Value

bool

IsSingleCell

protected bool IsSingleCell { get; }

Property Value

bool

IsStringsPreserved

Indicates whether all values in the range are preserved as strings.

public bool? IsStringsPreserved { get; set; }

Property Value

bool?

IsWrapText

Determines if Microsoft Excel wraps the text in the object. The following code illustrates how to access WrapText property:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["A1"].Text = "This cell contains sample text";

//Set wrap text
worksheet["A1"].IsWrapText = true;

//Save to file
workbook.SaveToFile("IsWrapText.xlsx");
public bool IsWrapText { get; set; }

Property Value

bool

this[int, int]

Gets / sets cell by row and column index. Row and column indexes are one-based.

public IXLSRange this[int row, int column] { get; set; }

Parameters

row int
column int

Property Value

IXLSRange

this[int, int, int, int]

Get cell range. Row and column indexes are one-based. Read-only.

public IXLSRange this[int row, int column, int lastRow, int lastColumn] { get; }

Parameters

row int
column int
lastRow int
lastColumn int

Property Value

IXLSRange

this[string]

Get cell range. Read-only.

public IXLSRange this[string name] { get; }

Parameters

name string

Property Value

IXLSRange

this[string, bool]

Gets cell range. Read-only.

public IXLSRange this[string name, bool IsR1C1Notation] { get; }

Parameters

name string
IsR1C1Notation bool

Property Value

IXLSRange

LastColumn

Gets or sets last column of the range.

public int LastColumn { get; set; }

Property Value

int

LastRow

Gets or sets last row of the range.

public int LastRow { get; set; }

Property Value

int

MergeArea

Returns a Range object that represents the merged range containing the specified cell. If the specified cell is not in a merged range, this property returns NULL. Read-only. The following code illustrates how to access MergeArea property:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["C2"].Text = "Sample text in cell";//Set mergeworksheet["C2:D3"].Merge();//Check merge areaConsole.Write(worksheet["C2"].MergeArea.AddressLocal);
public IXLSRange MergeArea { get; }

Property Value

IXLSRange

NumberFormat

Returns or sets the format code for the object. The following code illustrates how to set NumberFormat property:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set data
worksheet["C2"].Value = "3100.23";

//Set number format
worksheet["C2"].NumberFormat = "#,##1.##";

//Save to file
workbook.SaveToFile("NumberFormat.xlsx");
public string NumberFormat { get; set; }

Property Value

string

NumberText

Returns cell text for number format. The following code illustrates how to access NumberText property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Gets cell value with its number format
CellRange range= worksheet.Range[3, 1];
range.Value = "1/1/2015";
range.NumberFormat = "dd-MMM-yyyy";
string numberText = range.NumberText;

//Save to file
workbook.SaveToFile("NumberText.xlsx");
public string NumberText { get; }

Property Value

string

NumberValue

Gets or sets number value of the range.

public double NumberValue { get; set; }

Property Value

double

Parent

public object Parent { get; }

Property Value

object

RangeAddress

Returns the range reference in the language of the macro. Read-only String. The following code illustrates how to access Address property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Get RangeAddress
string address = worksheet.Range[3, 4].RangeAddress;
public string RangeAddress { get; }

Property Value

string

RangeAddressLocal

Returns the range reference for the specified range in the language of the user. The following code illustrates how to access AddressLocal property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Get RangeAddressLocal
string address = worksheet.Range[3, 4].RangeAddressLocal;
public string RangeAddressLocal { get; }

Property Value

string

RangeGlobalAddress

Returns the range reference in the language of the macro. The following code illustrates how to access AddressGlobal property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Get RangeAddress
string address = worksheet.Range[3, 4].RangeGlobalAddress;
public string RangeGlobalAddress { get; }

Property Value

string

RangeGlobalAddress2007

Gets address global in the format required by Excel 2007.

public string RangeGlobalAddress2007 { get; }

Property Value

string

RangeGlobalAddressWithoutSheetName

Return global address without worksheet name.

public string RangeGlobalAddressWithoutSheetName { get; }

Property Value

string

RangeR1C1Address

Returns the range reference using R1C1 notation. The following code illustrates how to access AddressR1C1 property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Get RangeR1C1Address
string address = worksheet.Range[3, 4].RangeR1C1Address;
public string RangeR1C1Address { get; }

Property Value

string

RangeR1C1AddressLocal

Returns the range reference using R1C1 notation. The following code illustrates how to access AddressR1C1Local property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Get RangeR1C1AddressLocal
string address = worksheet.Range[3, 4].RangeR1C1Address;
public string RangeR1C1AddressLocal { get; }

Property Value

string

RichText

String with rich text formatting. Read-only. The following code illustrates how to set rich text formatting in the range:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Create styleIStyle style = workbook.Styles.Add("CustomStyle");//Set rich textIRichTextString richText = worksheet["C2"].RichText;richText.Text = "Sample text";//Set rich text fontIFont font = style.Font;font.IsBold = true;richText.SetFont(0, 5, font);//Save to fileworkbook.SaveToFile("RichText.xlsx");
public IRichTextString RichText { get; }

Property Value

IRichTextString

Row

Returns the number of the first row of the first area in the range.

public int Row { get; }

Property Value

int

RowCount

Gets number of rows.

public int RowCount { get; }

Property Value

int

RowGroupLevel

Row group level.

public int RowGroupLevel { get; }

Property Value

int

Remarks

-1 - column group is not same. 0 - Not group 1 - 7 - group level.

RowHeight

Returns the height of all the rows in the range specified, measured in points. The following code illustrates how to set row height:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["A1"].Text = "Test";

//Set row height
worksheet["A1"].RowHeight = 30;

//Save to file
workbook.SaveToFile("RowHeight.xlsx");
public double RowHeight { get; set; }

Property Value

double

Rows

For a Range object, returns an array of Range objects that represent the rows in the specified range. The following code illustrates how to access rows:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set rowsIXLSRange[] rows = worksheet["A1:E8"].Rows;//Do some manipulationsforeach (IXLSRange row in rows)  row.Text = row.RangeAddressLocal;//Save to fileworkbook.SaveToFile("Rows.xlsx");
public IXLSRange[] Rows { get; }

Property Value

IXLSRange[]

Style

Returns a Style object that represents the style of the specified range. Read/write IStyle. The following code illustrates how to the style of the specified range:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["C2"].Text = "Sample";//Add and set styleCellStyle style = workbook.Styles.Add("BorderStyle");style.Color = Color.Red;worksheet["C2"].Style = style;//Save to fileworkbook.SaveToFile("Style.xlsx");
public IStyle Style { get; set; }

Property Value

IStyle

Text

Gets / sets text of range.

public string Text { get; set; }

Property Value

string

TimeSpanValue

Gets or sets timespan value of cell.

public TimeSpan TimeSpanValue { get; set; }

Property Value

TimeSpan

Value

Returns or sets the value of the specified range. The following code illustrates how to set Value of the specified range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set value of the range
CellRange range= worksheet.Range[3, 1];
range.Value = "1/1/2015";

//Save to file
workbook.SaveToFile("Value.xlsx");
public string Value { get; set; }

Property Value

string

Value2

Returns or sets the cell value. It's not use for current and datetime types. The following code illustrates how to access Value2 property of the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Assigning Value2 property of the Range
worksheet["A1"].Value2 = DateTime.Now;
worksheet["A3"].Value2 = false;

//Checking Range types
Console.WriteLine(worksheet["A1"].HasDateTime);
Console.WriteLine(worksheet["A3"].HasBoolean);
public object Value2 { get; set; }

Property Value

object

VerticalAlignment

Returns or sets the vertical alignment of the specified object. The following code illustrates how to set vertical alignment type:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["A1"].Text = "Test";

//Set alignment
worksheet["A1"].VerticalAlignment = VerticalAlignType.Top;

//Save to file
workbook.SaveToFile("VerticalAlignment.xlsx");
public VerticalAlignType VerticalAlignment { get; set; }

Property Value

VerticalAlignType

Workbook

protected XlsWorkbook Workbook { get; }

Property Value

XlsWorkbook

Worksheet

Returns a worksheet object that represents the worksheet containing the specified range.

public IWorksheet Worksheet { get; }

Property Value

IWorksheet

WorksheetName

Returns name of the parent worksheet.

public string WorksheetName { get; }

Property Value

string

Methods

Activate()

Active single cell in the worksheet

public IXLSRange Activate()

Returns

IXLSRange

Returns the active cell.

Activate(bool)

Activates a single cell, scroll to it and activates the corresponding sheet. To select a range of cells, use the Select method. The following code illustrates how to activate a Range with scroll flag:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Activates 'F1' cell.
worksheet.Range["F1"].Activate(true);

//Save to file
workbook.SaveToFile("Activate.xlsx");
public virtual IXLSRange Activate(bool scroll)

Parameters

scroll bool

True to scroll to the cell

Returns

IXLSRange

Returns the active cell.

AddCombinedRange(CellRange)

public CellRange AddCombinedRange(CellRange cr)

Parameters

cr CellRange

Returns

CellRange

AddComment()

Adds a comment to the range.

public ICommentShape AddComment()

Returns

ICommentShape

Created comment or exists one.

AddComment(ICommentShape)

protected void AddComment(ICommentShape comment)

Parameters

comment ICommentShape

AddComment(bool)

public ICommentShape AddComment(bool bIsParseOptions)

Parameters

bIsParseOptions bool

Returns

ICommentShape

ApplyStyle(IStyle, CellStyleFlag)

public void ApplyStyle(IStyle style, CellStyleFlag flag)

Parameters

style IStyle
flag CellStyleFlag

AutoFitColumns()

Changes the width of the columns in the range in the range to achieve the best fit. The following code illustrates how to auto-size column width to its cell content:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Auto-fit columns
worksheet.Range["B4"].Text = "Fit the content to column";
worksheet.Range["B4"].AutoFitColumns();

//Save to file
workbook.SaveToFile("AutoFitRows.xlsx");
public void AutoFitColumns()

AutoFitRows()

Changes the width of the height of the rows in the range to achieve the best fit. The following code illustrates how to auto-size row height to its cell content:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Auto-fit rows
worksheet.Range["A2"].Text = "Fit the content to row";
worksheet.Range["A2"].IsWrapText = true;
worksheet.Range["A2"].AutoFitRows();

//Save to file
workbook.SaveToFile("AutoFitRows.xlsx");
public void AutoFitRows()

BorderAround()

Sets around border for current range. The following code illustrates how to apply border around the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["C2"].Text = "Sample";
worksheet["D2"].Text = "text";
worksheet["C3"].Text = "in";
worksheet["D3"].Text = "cell";

//Set border
worksheet["C2:D3"].BorderAround();

//Save to file
workbook.SaveToFile("BorderAround.xlsx");
public void BorderAround()

BorderAround(LineStyleType)

Sets around border for current range. The following code illustrates how to apply border around the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["C2"].Text = "Sample";
worksheet["D2"].Text = "text";
worksheet["C3"].Text = "in";
worksheet["D3"].Text = "cell";

//Set border
worksheet["C2:D3"].BorderAround(LineStyleType.Thick);

//Save to file
workbook.SaveToFile("BorderAround.xlsx");
public void BorderAround(LineStyleType borderLine)

Parameters

borderLine LineStyleType

Represents border line.

BorderAround(LineStyleType, ExcelColors)

Sets around border for current range. The following code illustrates how to apply border around the Range with color from Spire.Xls.ExcelColors structure:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["C2"].Text = "Sample";
worksheet["D2"].Text = "text";
worksheet["C3"].Text = "in";
worksheet["D3"].Text = "cell";

//Set border
worksheet["C2:D3"].BorderAround(LineStyleType.Thick , ExcelColors.Red);

//Save to file
workbook.SaveToFile("BorderAround.xlsx");
public void BorderAround(LineStyleType borderLine, ExcelColors borderColor)

Parameters

borderLine LineStyleType

Represents border line.

borderColor ExcelColors

Represents border color as ExcelColors.

BorderAround(LineStyleType, Color)

Sets around border for current range. The following code illustrates how to apply border around the Range with color from System.Drawing.Color structure:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["C2"].Text = "Sample";
worksheet["D2"].Text = "text";
worksheet["C3"].Text = "in";
worksheet["D3"].Text = "cell";

//Set border
worksheet["C2:D3"].BorderAround(LineStyleType.Thick , Color.Red);

//Save to file
workbook.SaveToFile("BorderAround.xlsx");
public void BorderAround(LineStyleType borderLine, Color borderColor)

Parameters

borderLine LineStyleType

Represents border line.

borderColor Color

Represents border color.

BorderInside()

Sets inside border for current range. The following code illustrates how to apply border inside the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["C2"].Text = "Sample";
worksheet["D2"].Text = "text";
worksheet["C3"].Text = "in";
worksheet["D3"].Text = "cell";

//Set border
worksheet["C2:D3"].BorderInside();

//Save to file
workbook.SaveToFile("BorderInside.xlsx");
public void BorderInside()

BorderInside(LineStyleType)

Sets inside border for current range. The following code illustrates how to apply border inside the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["C2"].Text = "Sample";
worksheet["D2"].Text = "text";
worksheet["C3"].Text = "in";
worksheet["D3"].Text = "cell";

//Set border
worksheet["C2:D3"].BorderInside(LineStyleType.Thick);

//Save to file
workbook.SaveToFile("BorderInside.xlsx");
public void BorderInside(LineStyleType borderLine)

Parameters

borderLine LineStyleType

Represents border line.

BorderInside(LineStyleType, ExcelColors)

Sets inside border for current range. The following code illustrates how to apply border inside the Range with color from Spire.Xls.ExcelColors structure:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["C2"].Text = "Sample";
worksheet["D2"].Text = "text";
worksheet["C3"].Text = "in";
worksheet["D3"].Text = "cell";

//Set border
worksheet["C2:D3"].BorderInside(LineStyleType.Thick , ExcelColors.Red);

//Save to file
workbook.SaveToFile("BorderInside.xlsx");
public void BorderInside(LineStyleType borderLine, ExcelColors borderColor)

Parameters

borderLine LineStyleType

Represents border line.

borderColor ExcelColors

Represents border color as ExcelColors.

BorderInside(LineStyleType, Color)

Sets inside border for current range. The following code illustrates how to apply border inside the Range with color from System.Drawing.Color structure:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["C2"].Text = "Sample";
worksheet["D2"].Text = "text";
worksheet["C3"].Text = "in";
worksheet["D3"].Text = "cell";

//Set border
worksheet["C2:D3"].BorderInside(LineStyleType.Thick , Color.Red);

//Save to file
workbook.SaveToFile("BorderInside.xlsx");
public void BorderInside(LineStyleType borderLine, Color borderColor)

Parameters

borderLine LineStyleType

Represents border line.

borderColor Color

Represents border color.

BorderNone()

Sets none border for current range. The following code illustrates how to remove borders in the Range:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Remove borders
worksheet["C2"].BorderNone();

//Save to file
workbook.SaveToFile("BorderNone.xlsx");
public void BorderNone()

CalculateAllValue()

Caculate all formula for the specified range

public void CalculateAllValue()

CheckRange(int, int)

protected void CheckRange(int row, int column)

Parameters

row int
column int

Clear(ExcelClearOptions)

Clears the cell based on clear options. The following code illustrates how to clear the Range with clear options:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Clears the Range C2 with its clear options
worksheet.Range["C2"].Clear(ExcelClearOptions.ClearAll);

//Save to file
workbook.SaveToFile("ClearContents.xlsx");
public void Clear(ExcelClearOptions option)

Parameters

option ExcelClearOptions

Represents the clear options.

Clear(bool)

protected void Clear(bool isClearFormat)

Parameters

isClearFormat bool

ClearAll()

Clears the entire object.

public void ClearAll()

ClearConditionalFormats()

Clears conditional formats.

public void ClearConditionalFormats()

ClearContents()

Clear the contents of the Range. The following code illustrates how to clear the Range:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Clears the Range C2
worksheet.Range["C2"].ClearContents();

//Save to file
workbook.SaveToFile("ClearContents.xlsx");
public void ClearContents()

Clone(object, Dictionary<string, string>, XlsWorkbook)

public IXLSRange Clone(object parent, Dictionary<string, string> rangeNames, XlsWorkbook book)

Parameters

parent object
rangeNames Dictionary<string, string>
book XlsWorkbook

Returns

IXLSRange

CollapseGroup(GroupByType)

Collapses current group. The following code illustrates how to remove borders in the Range:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Collapse group
worksheet.Range["A5:A15"].CollapseGroup(GroupByType.ByRows);

//Save to file
workbook.SaveToFile("CollapseGroup.xlsx");
public void CollapseGroup(GroupByType groupBy)

Parameters

groupBy GroupByType

This parameter specifies whether the grouping should be performed by rows or by columns.

ConvertToNumber()

Convert number that stored as text to number

public void ConvertToNumber()

CopyToClipboard()

[Obsolete("the method is not implemented")]
public void CopyToClipboard()

Dispose()

public void Dispose()

ExpandGroup(GroupByType)

Expands current group. The following code illustrates how to expand the group in the Range:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Expand group with flag set to expand parent
worksheet.Range["A5:A15"].ExpandGroup(GroupByType.ByRows);

//Save to file
workbook.SaveToFile("ExpandGroup.xlsx");
public void ExpandGroup(GroupByType groupBy)

Parameters

groupBy GroupByType

This parameter specifies whether the grouping should be performed by rows or by columns.

ExpandGroup(GroupByType, ExpandCollapseFlags)

Expands current group. The following code illustrates how to perform ExpandGroup in the Range with collapse option:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Expand group with flag set to expand parent
worksheet.Range["A5:A15"].ExpandGroup(GroupByType.ByRows, ExpandCollapseFlags.ExpandParent);

//Save to file
workbook.SaveToFile("ExpandGroup.xlsx");
public void ExpandGroup(GroupByType groupBy, ExpandCollapseFlags flags)

Parameters

groupBy GroupByType

This parameter specifies whether the grouping should be performed by rows or by columns.

flags ExpandCollapseFlags

Additional option flags.

ExportDataTable(ExportTableOptions)

public DataTable ExportDataTable(ExportTableOptions options)

Parameters

options ExportTableOptions

Returns

DataTable

FindAll(bool)

protected CellRange[] FindAll(bool findValue)

Parameters

findValue bool

Returns

CellRange[]

FindAll(DateTime)

protected CellRange[] FindAll(DateTime findValue)

Parameters

findValue DateTime

Returns

CellRange[]

FindAll(double, FindType)

protected CellRange[] FindAll(double findValue, FindType flags)

Parameters

findValue double
flags FindType

Returns

CellRange[]

FindAll(string, FindType)

protected CellRange[] FindAll(string findValue, FindType flags)

Parameters

findValue string
flags FindType

Returns

CellRange[]

FindAll(string, FindType, ExcelFindOptions)

protected CellRange[] FindAll(string findValue, FindType flags, ExcelFindOptions findOptions)

Parameters

findValue string
flags FindType
findOptions ExcelFindOptions

Returns

CellRange[]

FindAll(TimeSpan)

protected CellRange[] FindAll(TimeSpan findValue)

Parameters

findValue TimeSpan

Returns

CellRange[]

FindFirst(bool)

protected IXLSRange FindFirst(bool findValue)

Parameters

findValue bool

Returns

IXLSRange

FindFirst(DateTime)

protected IXLSRange FindFirst(DateTime findValue)

Parameters

findValue DateTime

Returns

IXLSRange

FindFirst(double, FindType)

protected IXLSRange FindFirst(double findValue, FindType flags)

Parameters

findValue double
flags FindType

Returns

IXLSRange

FindFirst(string, FindType)

protected IXLSRange FindFirst(string findValue, FindType flags)

Parameters

findValue string
flags FindType

Returns

IXLSRange

FindFirst(TimeSpan)

protected IXLSRange FindFirst(TimeSpan findValue)

Parameters

findValue TimeSpan

Returns

IXLSRange

FindWorksheet(string)

protected IWorksheet FindWorksheet(string sheetName)

Parameters

sheetName string

Returns

IWorksheet

FreezePanes()

Freezes panes at the current range in the worksheet. current range should be single cell range. The following code illustrates how to freeze a pane in the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Applying Freeze Pane to the sheet by specifying a cell
worksheet.Range["B2"].FreezePanes();

//Save to file
workbook.SaveToFile("FreezePanes.xlsx");
public void FreezePanes()

GetConditionFormatsStyle()

Get the calculated condition format style of current Range. If style of every cell is not same, return null. If current range without condition format, return null.

public CellStyle GetConditionFormatsStyle()

Returns

CellStyle

GetEnumerator()

public IEnumerator<IXLSRange> GetEnumerator()

Returns

IEnumerator<IXLSRange>

GetNewRangeLocation(Dictionary<string, string>, out string)

Gets new range location.

public string GetNewRangeLocation(Dictionary<string, string> names, out string sheetName)

Parameters

names Dictionary<string, string>

Worksheet names.

sheetName string

Returns

string

New name.

GetRectangles()

Gets rectangle information of current range.

public Rectangle[] GetRectangles()

Returns

Rectangle[]

Rectangles information

GetRectanglesCount()

Returns number of rectangles..

public int GetRectanglesCount()

Returns

int

Number of rectangles.

GroupByColumns(bool)

Groups columns.

public CellRange GroupByColumns(bool isCollapsed)

Parameters

isCollapsed bool

Indicates whether group should be collapsed.

Returns

CellRange

GroupByRows(bool)

Groups row.

public CellRange GroupByRows(bool isCollapsed)

Parameters

isCollapsed bool

Indicates whether group should be collapsed.

Returns

CellRange

InfillCells()

protected void InfillCells()

Intersect(IXLSRange)

Returns intersection of this range with the specified one. The following code illustrates how to perform intersectwith in the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Get intersect range
IXLSRange range = worksheet.Range["A16:C16"];
IXLSRange commonRange = worksheet.Range["B16:D16"].Intersect(range);

//Save to file
workbook.SaveToFile("Intersect.xlsx");
public IXLSRange Intersect(IXLSRange range)

Parameters

range IXLSRange

The Range with which to intersect.

Returns

IXLSRange

Range intersection. If there is no intersection, NULL is returned.

IsIntersect(IXLSRange)

public bool IsIntersect(IXLSRange range)

Parameters

range IXLSRange

Returns

bool

MeasureString(string)

Measures size of the string.

public SizeF MeasureString(string measureString)

Parameters

measureString string

String to measure.

Returns

SizeF

Size of the string.

Merge()

Creates a merged cell from the specified Range object. The following code illustrates how to merge the Range:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["A1"].Text = "Merged cell";

//Merge cells
worksheet["A1:B1"].Merge();

//Save to file
workbook.SaveToFile("Merge.xlsx");
public void Merge()

Merge(IXLSRange)

Creates a merged cell from the specified Range object.

public IXLSRange Merge(IXLSRange range)

Parameters

range IXLSRange

The Range to merge with.

Returns

IXLSRange

Merged ranges or null if wasn't able to merge ranges.

Merge(bool)

Creates a merged cell from the specified Range object. The following code illustrates how to merge the Range with clear option:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["A1"].Text = "Merged cell";
worksheet["B1"].Text = "sample";

//Merge cells
worksheet["A1:B1"].Merge(true);

//Save to file
workbook.SaveToFile("Merge.xlsx");
public void Merge(bool clearCells)

Parameters

clearCells bool

Indicates whether to clear unnecessary cells.

MoveTo(IXLSRange)

protected void MoveTo(IXLSRange destination)

Parameters

destination IXLSRange

MoveTo(IXLSRange, bool)

protected void MoveTo(IXLSRange destination, bool bUpdateFormula)

Parameters

destination IXLSRange
bUpdateFormula bool

PartialClear()

Partially clear range.

public void PartialClear()

RemoveCombinedRange(CellRange)

public void RemoveCombinedRange(CellRange cr)

Parameters

cr CellRange

RemoveMergeComment()

public void RemoveMergeComment()

ReparseFormulaString()

Reparses formula.

public void ReparseFormulaString()

Replace(string, DataColumn, bool)

Replaces cells' values with new data.

public void Replace(string oldValue, DataColumn newValues, bool isFieldNamesShown)

Parameters

oldValue string

Value to search for.

newValues DataColumn

DataColumn to replace.

isFieldNamesShown bool

Indicates whether to insert values vertically or horizontally.

Replace(string, DataTable, bool)

Replaces cells' values with new data.

public void Replace(string oldValue, DataTable newValues, bool isFieldNamesShown)

Parameters

oldValue string

Value to search for.

newValues DataTable

The replacement value.

isFieldNamesShown bool

Replace(string, DateTime)

Replaces cells' values with new data.

public void Replace(string oldValue, DateTime newValue)

Parameters

oldValue string

Value to search for.

newValue DateTime

The replacement value.

Replace(string, double)

Replaces cells' values with new data.

public void Replace(string oldValue, double newValue)

Parameters

oldValue string

Value to search for.

newValue double

The replacement value.

Replace(string, double[], bool)

Replaces cells' values with new data.

public void Replace(string oldValue, double[] newValues, bool isVertical)

Parameters

oldValue string

Value to search for.

newValues double[]

DataColumn to replace.

isVertical bool

Replace(string, int[], bool)

Replaces cells' values with new data.

public void Replace(string oldValue, int[] newValues, bool isVertical)

Parameters

oldValue string

Value to search for.

newValues int[]

The replacement value.

isVertical bool

Indicates whether to insert values vertically or horizontally.

Replace(string, string)

Replaces cells' values with new data.

public void Replace(string oldValue, string newValue)

Parameters

oldValue string

Value to search for.

newValue string

The replacement value.

Replace(string, string[], bool)

Replaces cells' values with new data.

public void Replace(string oldValue, string[] newValues, bool isVertical)

Parameters

oldValue string

Value to search for.

newValues string[]

The replacement value.

isVertical bool

Indicates whether to insert values vertically or horizontally.

SetAutoFormat(AutoFormatType)

[Obsolete("the method is not implemented")]
public void SetAutoFormat(AutoFormatType format)

Parameters

format AutoFormatType

SetAutoFormat(AutoFormatType, AutoFormatOptions)

[Obsolete("the method is not implemented")]
public void SetAutoFormat(AutoFormatType format, AutoFormatOptions options)

Parameters

format AutoFormatType
options AutoFormatOptions

SetBorderToSingleCell(BordersLineType, LineStyleType, ExcelColors)

protected void SetBorderToSingleCell(BordersLineType borderIndex, LineStyleType borderLine, ExcelColors borderColor)

Parameters

borderIndex BordersLineType
borderLine LineStyleType
borderColor ExcelColors

SetDataValidation(XlsValidation)

public void SetDataValidation(XlsValidation dv)

Parameters

dv XlsValidation

SetExtendedFormatIndex(int)

public void SetExtendedFormatIndex(int index)

Parameters

index int

SetRowHeight(double, bool)

public void SetRowHeight(double rowHeight, bool bIsBadFontHeight)

Parameters

rowHeight double
bIsBadFontHeight bool

SetSharedFormula(string, int, int)

public void SetSharedFormula(string sharedFormula, int rowNumber, int columnNumber)

Parameters

sharedFormula string
rowNumber int
columnNumber int

TextPartReplace(string, string)

Replaces cell's part text and reserve text's format.

public void TextPartReplace(string oldPartValue, string newPartValue)

Parameters

oldPartValue string

Part value of cell's text to search for.

newPartValue string

The replacement value.

UnMerge()

Separates a merged area into individual cells. The following code illustrates how to UnMerge the merged cells:

//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Set text
worksheet["A1"].Text = "Merged cell";

//Merge cells
worksheet["A1:B1"].Merge(true);

//Unmerge cells
worksheet["A1:B1"].UnMerge();

//Save to file
workbook.SaveToFile("UnMerge.xlsx");
public void UnMerge()

UngroupByColumns()

Ungroups column.

public CellRange UngroupByColumns()

Returns

CellRange

UngroupByRows()

Ungroups row.

public CellRange UngroupByRows()

Returns

CellRange

Union(CellRange)

public RangesCollection Union(CellRange range)

Parameters

range CellRange

Returns

RangesCollection

UpdateRange(int, int, int, int)

Update region of range

public void UpdateRange(int startRow, int startColumn, int endRow, int endColumn)

Parameters

startRow int

first Row

startColumn int

first Column

endRow int

last Row

endColumn int

last Column