CellRange Properties |
The CellRange type exposes the following members.
| Name | Description | |
|---|---|---|
|
|
BooleanValue |
Returns or sets the bool value of the specified range.
(Inherited from
XlsRange
.)
The following code illustrates how to access Boolean property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set and get BooleanValue</para><para>worksheet.Range[2, 4].BooleanValue = true;</para><para>bool boolean = worksheet.Range[2, 4].BooleanValue;</para>
|
|
|
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:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["C2"].Text = "Sample";</para><para>//Set borders</para><para>IBorders borders = worksheet["C2"].Borders;</para><para>//Set line style</para><para>borders[BordersLineType.EdgeTop].LineStyle = LineStyleType.Thin;</para><para>borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thin;</para><para>//Set border color</para><para>borders[BordersLineType.EdgeTop].Color = Color.Red;</para><para>borders[BordersLineType.EdgeBottom].Color = Color.Red;</para><para>//Save to file</para><para>workbook.SaveToFile("CellFormats.xlsx");</para>
|
|
|
BuiltInStyle |
Gets/sets built in style.
(Inherited from
XlsRange
.)
The following code illustrates how to access BuiltInStyle property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["C2"].Text = "Sample";</para><para>//Set built in style</para><para>worksheet["C2"].BuiltInStyle = BuiltInStyles.Accent3;</para><para>//Save to file</para><para>workbook.SaveToFile("BuiltInStyle.xlsx");</para>
|
|
|
CellList |
Returns a Range object that represents the cells in the specified range.
The following code illustrates how to access CellList property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text. The content contained by ![CDATA[]] will be expressed as plain text</para><para>ListCellRange cells = worksheet["A1:E8"].CellList;</para><para>//Do some manipulations</para><para>foreach (CellRange Range in cells)</para><para>Range.Text = Range.RangeAddressLocal;</para><para>//Save to file</para><para>workbook.SaveToFile("CellList.xlsx");</para>
|
|
|
Cells |
Obsolete.
Returns a Range object that represents the cells in the specified range.
|
|
|
CellsCount |
Gets number of cells.
(Inherited from
XlsRange
.)
|
|
|
CellStyleName |
Gets/sets name of the style for the current range.
(Inherited from
XlsRange
.)
The following code illustrates how to access CellStyleName of the specified range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add and set style</para><para>CellStyle style = workbook.Styles.Add("CustomStyle");</para><para>worksheet["C2"].Style = style;</para><para>//Check Style name</para><para>Console.Write(worksheet["C2"].CellStyleName);</para>
|
|
|
Column |
Returns the number of the first column in the first area in the specified range.
(Inherited from
XlsRange
.)
The following code illustrates how to access Column property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get specified column</para><para>int firstColumn = worksheet["E1:R3"].Column;</para>
|
|
|
ColumnCount |
Gets number of columns.
(Inherited from
XlsRange
.)
|
|
|
ColumnGroupLevel |
Column group level.
(Inherited from
XlsRange
.)
|
|
|
Columns |
Returns a Range object that represents the columns in the specified range.
The following code illustrates how to access columns:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set columns</para><para>IXLSRange[] columns = worksheet["A1:E8"].Columns;</para><para>//Do some manipulations</para><para>foreach (IXLSRange column in columns)</para><para>column.Text = column.RangeAddressLocal;</para><para>//Save to file</para><para>workbook.SaveToFile("Columns.xlsx");</para>
|
|
|
ColumnWidth |
Returns or sets the width of all columns in the specified range.
(Inherited from
XlsRange
.)
The following code illustrates how to set the width of all columns in the specified range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set the ColumnWidth</para><para>worksheet["A1"].Text = "This cell contains sample text";</para><para>worksheet["A1"].ColumnWidth = 25;</para><para>//Save to file</para><para>workbook.SaveToFile("ColumnWidth.xlsx");</para>
|
|
|
CombinedAddress |
Returns the combined range reference in the language.
Read-only String.
(Inherited from
XlsRange
.)
|
|
|
CombinedCells |
Gets the list of combined cells.
(Inherited from
XlsRange
.)
|
|
|
Comment |
Returns a Comment object that represents the comment associated with the cell in the upper-left corner of the range.
The following code illustrates how to access Comments property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Adding comments to a cell</para><para>worksheet.Range["A1"].AddComment().Text = "Comments";</para><para>//Add Rich Text Comments</para><para>CellRange range = worksheet.Range["A6"];</para><para>range.AddComment().RichText.Text = "RichText";</para><para>IRichTextString rtf = range.Comment.RichText;</para><para>//Formatting first 4 characters</para><para>IFont redFont = workbook.CreateFont();</para><para>redFont.IsBold = true;</para><para>redFont.Color = Color.Red;</para><para>rtf.SetFont(0, 3, redFont);</para><para>//Save to file</para><para>workbook.SaveToFile("DataValidation.xlsx");</para>
|
|
|
ConditionalFormats |
Obsolete.
Collection of conditional formats for the range.
(Inherited from
XlsRange
.)
|
|
|
Count |
Returns the number of objects in the collection.
(Inherited from
XlsRange
.)
|
|
|
CurrentRegion |
Get the range associated with a range.
(Inherited from
XlsRange
.)
|
|
|
DataValidation |
Get dataValidation of the sheet. Read Only.
(Inherited from
XlsRange
.)
The following code illustrates how to access DataValidation property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Data validation for number</para><para>IDataValidation validation = worksheet.Range["A3"].DataValidation;</para><para>validation.AllowType = CellDataType.Integer;</para><para>//Value between 0 to 10</para><para>validation.CompareOperator = ValidationComparisonOperator.Between;</para><para>validation.Formula1 = "0";</para><para>validation.Formula2 = "10";</para><para>//Save to file</para><para>workbook.SaveToFile("DataValidation.xlsx");</para>
|
|
|
DateTimeValue |
Gets/sets DateTime value of the range.
(Inherited from
XlsRange
.)
The following code illustrates how to set and access DateTimeValue property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set and get the DateTimeValue of specified range</para><para>worksheet.Range[2, 4].DateTimeValue = DateTime.Now;</para><para>DateTime dateTime = worksheet.Range[2, 4].DateTimeValue;</para><para>//Save to file</para><para>workbook.SaveToFile("DateTimeValue.xlsx");</para>
|
|
|
DisplayedText |
Gets cell displayed text.
(Inherited from
XlsRange
.)
|
|
|
EndCell |
Returns a Range object that represents the cell at the end of the
region that contains the source range.
|
|
|
EntireColumn |
Returns a Range object that represents the entire column (or
columns) that contains the specified range.
|
|
|
EntireRow |
Returns a Range object that represents the entire row (or rows) that contains the specified range.
|
|
|
EnvalutedValue |
Returns the calculated value of a formula.
(Inherited from
XlsRange
.)
The following code illustrates how to access a calculated value:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Returns the calculated value of a formula using the most current inputs</para><para>string calculatedValue = worksheet["C1"].EnvalutedValue;</para><para>Console.WriteLine(calculatedValue);</para>
|
|
|
ErrorValue |
Gets or sets error value of this range.
(Inherited from
XlsRange
.)
|
|
|
ExtendedFormatIndex |
Sets / gets index of extended format.
(Inherited from
XlsRange
.)
|
|
|
FirstColumn |
Gets or sets the index of the first column in the range.
(Inherited from
XlsRange
.)
|
|
|
FirstRow |
Gets or sets the first row of the range.
(Inherited from
XlsRange
.)
|
|
|
Formula |
Returns or sets the object's formula in A1-style notation and in
the language of the macro.
(Inherited from
XlsRange
.)
|
|
|
FormulaArray |
Returns or sets the array formula of a range.
(Inherited from
XlsRange
.)
The following code illustrates how to set and access FormulaArray property of the range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Assign array formula</para><para>worksheet.Range["A1:D1"].FormulaArray = "{1,2,3,4}";</para><para>//Adding a named range for the range A1 to D1</para><para>worksheet.Names.Add("ArrayRange", worksheet.Range["A1:D1"]);</para><para>//Assign formula array with named range</para><para>worksheet.Range["A2:D2"].FormulaArray = "ArrayRange+100";</para><para>//Save to file</para><para>workbook.SaveToFile("FormulaArray.xlsx");</para>
|
|
|
FormulaArrayR1C1 |
Returns or sets the formula for the object, using R1C1-style notation in the language of the macro
(Inherited from
XlsRange
.)
|
|
|
FormulaBoolValue |
Gets or sets bool value of the formula.
(Inherited from
XlsRange
.)
|
|
|
FormulaDateTime |
Gets or sets bool value of the formula.
(Inherited from
XlsRange
.)
|
|
|
FormulaErrorValue |
Gets or sets error value of the formula.
(Inherited from
XlsRange
.)
|
|
|
FormulaNumberValue |
Gets or sets double value of the formula.
(Inherited from
XlsRange
.)
|
|
|
FormulaR1C1 |
Returns or sets the formula for the object, using R1C1-style notation in the language of the macro
(Inherited from
XlsRange
.)
|
|
|
FormulaStringValue |
Gets or sets string value of the range.
(Inherited from
XlsRange
.)
|
|
|
FormulaValue |
Gets formula value.
(Inherited from
XlsRange
.)
|
|
|
HasBoolean |
Indicates whether range contains bool value.
(Inherited from
XlsRange
.)
The following code illustrates how to set and access HasBoolean property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Assigning Value2 property of the Range</para><para>worksheet["A3"].Value2 = false;</para><para>//Checking Range types</para><para>bool isboolean = worksheet["A3"].HasBoolean;</para><para>//Save to file</para><para>workbook.SaveToFile("HasBoolean.xlsx");</para>
|
|
|
HasComment |
Gets a value indicating whether the cell has a comment.
(Inherited from
XlsRange
.)
|
|
|
HasConditionFormats |
Indicates whether each cell of the range has some conditional formatting.
(Inherited from
XlsRange
.)
|
|
|
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.
(Inherited from
XlsRange
.)
|
|
|
HasDateTime |
Determines if all cells in the range contain datetime.
(Inherited from
XlsRange
.)
The following code illustrates how to set and access HasDateTime property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Assigning Value2 property of the Range</para><para>worksheet["A1"].Value2 = DateTime.Now;</para><para>//Checking Range types</para><para>bool isDateTime =worksheet["A1"].HasDateTime;</para><para>//Save to file</para><para>workbook.SaveToFile("HasDateTime.xlsx");</para>
|
|
|
HasError |
Indicates whether range contains error value.
(Inherited from
XlsRange
.)
|
|
|
HasExternalFormula |
Check if the formula in the range has external links. Read-only.
(Inherited from
XlsRange
.)
|
|
|
HasFormula |
True if all cells in the range contain formulas;
(Inherited from
XlsRange
.)
|
|
|
HasFormulaArray |
Determines if all cells in the range contain array-entered formula.
(Inherited from
XlsRange
.)
|
|
|
HasFormulaBoolValue |
Determines if all cells in the range contain formula bool value..
(Inherited from
XlsRange
.)
|
|
|
HasFormulaDateTime |
Indicates if current range has formula value formatted as DateTime. Read-only.
(Inherited from
XlsRange
.)
|
|
|
HasFormulaErrorValue |
Determines if all cells in the range contain error value.
(Inherited from
XlsRange
.)
|
|
|
HasFormulaNumberValue |
Indicates whether current range has formula number value.
(Inherited from
XlsRange
.)
|
|
|
HasFormulaStringValue |
Indicates whether current range contains formula value which evaluated as string.
(Inherited from
XlsRange
.)
|
|
|
HasMerged |
Indicates whether this range is part of merged range.
(Inherited from
XlsRange
.)
The following code illustrates how to access HasMerged property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["A1"].Text = "Sample text in cell";</para><para>//Set merge</para><para>worksheet["A1:B1"].Merge();</para><para>//Check merge</para><para>Console.Write(worksheet["A1:B1"].HasMerged);</para>
|
|
|
HasNumber |
Determines if any one cell in the range contain number.
(Inherited from
XlsRange
.)
The following code illustrates how to set and access Value2 property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Assigning Value2 property of the Range</para><para>worksheet["A2"].Value2 = 45;</para><para>//Checking Range types</para><para>bool isNumber =worksheet["A2"].HasNumber;</para><para>//Save to file</para><para>workbook.SaveToFile("HasNumber.xlsx");</para>
|
|
|
HasPictures |
Indicates whether the range is blank.
(Inherited from
XlsRange
.)
|
|
|
HasRichText |
Determines if all cells in the range contain rich text string.
(Inherited from
XlsRange
.)
The following code illustrates how to access HasRichText property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create style</para><para>IStyle style = workbook.Styles.Add("CustomStyle");</para><para>//Set rich text</para><para>IRichTextString richText = worksheet["C2"].RichText;</para><para>richText.Text = "Sample";</para><para>IFont font = style.Font;</para><para>font.Color = Color.Red;</para><para>richText.SetFont(0, 5, font);</para><para>//Check HasRichText</para><para>Console.Write(worksheet["C2"].HasRichText);</para><para>//Save to file</para><para>workbook.SaveToFile("HasRichText.xlsx");</para>
|
|
|
HasString |
Determines if all cells in the range contain string.
(Inherited from
XlsRange
.)
|
|
|
HasStyle |
Determines if all cells in the range containdiffers from default style.
(Inherited from
XlsRange
.)
The following code illustrates how to access HasStyle property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add style</para><para>CellStyle style = workbook.Styles.Add("CustomStyle");</para><para>//Set color and style</para><para>style.Color = Color.Red;</para><para>worksheet["C2"].Style = style;</para><para>//Check HasStyle</para><para>Console.Write(worksheet["C2"].HasStyle);</para><para>//Save to file</para><para>workbook.SaveToFile("HasStyle.xlsx");</para>
|
|
|
HorizontalAlignment |
Returns or sets the horizontal alignment for the specified object.
(Inherited from
XlsRange
.)
The following code illustrates how to set and access HasStyle property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["A1"].Text = "Test";</para><para>//Set alignment</para><para>worksheet["A1"].HorizontalAlignment = HorizontalAlignType.Right;</para><para>//Save to file</para><para>workbook.SaveToFile("HorizontalAlignment.xlsx");</para>
|
|
|
HtmlString |
Gets and sets the html string which contains data and some formattings in this cell.
(Inherited from
XlsRange
.)
|
|
|
Hyperlinks |
Returns hyperlinks for this range.
(Inherited from
XlsRange
.)
|
|
|
IgnoreErrorOptions |
Represents ignore error options. If not single cell returs concatenateed flags.
(Inherited from
XlsRange
.)
|
|
|
IndentLevel |
Returns or sets the indent level for the cell or range. value should be 0 between 15.
(Inherited from
XlsRange
.)
The following code illustrates how to set indent level for a cell:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["C2"].Text = "Sample";</para><para>//Set indent level</para><para>worksheet["C2"].IndentLevel = 2;</para><para>//Save to file</para><para>workbook.SaveToFile("IndentLevel.xlsx");</para>
|
|
|
IsAllNumber |
Determines if all cells in the range contain number.
(Inherited from
XlsRange
.)
|
|
|
IsBlank |
Indicates whether the range is blank.
(Inherited from
XlsRange
.)
|
|
|
IsFormulaHidden |
Determines if the formula will be hidden when the worksheet is protected.
(Inherited from
XlsRange
.)
|
|
|
IsGroupedByColumn |
Indicates whether this range is grouped by column.
(Inherited from
XlsRange
.)
|
|
|
IsGroupedByRow |
Indicates whether this range is grouped by row.
(Inherited from
XlsRange
.)
|
|
|
IsInitialized |
Indicates whether range has been initialized.
(Inherited from
XlsRange
.)
|
|
|
IsSingleCell |
Checks if the current selection is a single cell.
(Inherited from
XlsRange
.)
|
|
|
IsStringsPreserved |
Indicates whether all values in the range are preserved as strings.
(Inherited from
XlsRange
.)
|
|
|
IsWrapText |
Determines if Microsoft Excel wraps the text in the object.
(Inherited from
XlsRange
.)
The following code illustrates how to access WrapText property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["A1"].Text = "This cell contains sample text";</para><para>//Set wrap text</para><para>worksheet["A1"].IsWrapText = true;</para><para>//Save to file</para><para>workbook.SaveToFile("IsWrapText.xlsx");</para>
|
|
|
Item String |
Gets cell range.
|
|
|
Item Int32, Int32 |
Gets cell range. Row and column indexes are one-based.
|
|
|
Item String, Boolean |
Gets cell range
|
|
|
Item Int32, Int32, Int32, Int32 |
Gets cell range. Row and column indexes are one-based.
|
|
|
LastColumn |
Gets or sets last column of the range.
(Inherited from
XlsRange
.)
|
|
|
LastRow |
Gets or sets last row of the range.
(Inherited from
XlsRange
.)
|
|
|
MergeArea |
Returns a Range object that represents the merged range containing the specified cell.
The following code illustrates how to access MergeArea property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["C2"].Text = "Sample text in cell";</para><para>//Set merge</para><para>worksheet["C2:D3"].Merge();</para><para>//Check merge area</para><para>Console.Write(worksheet["C2"].MergeArea.AddressLocal);</para>
|
|
|
NumberFormat |
Returns or sets the format code for the object.
(Inherited from
XlsRange
.)
The following code illustrates how to set NumberFormat property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set data</para><para>worksheet["C2"].Value = "3100.23";</para><para>//Set number format</para><para>worksheet["C2"].NumberFormat = "#,##1.##";</para><para>//Save to file</para><para>workbook.SaveToFile("NumberFormat.xlsx");</para>
|
|
|
NumberText |
Returns cell text for number format.
(Inherited from
XlsRange
.)
The following code illustrates how to access NumberText property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Gets cell value with its number format</para><para>CellRange range= worksheet.Range[3, 1];</para><para>range.Value = "1/1/2015";</para><para>range.NumberFormat = "dd-MMM-yyyy";</para><para>string numberText = range.NumberText;</para><para>//Save to file</para><para>workbook.SaveToFile("NumberText.xlsx");</para>
|
|
|
NumberValue |
Gets or sets number value of the range.
(Inherited from
XlsRange
.)
|
|
|
Parent |
Parent object for this object.
(Inherited from
XlsRange
.)
|
|
|
RangeAddress |
Returns the range reference in the language of the macro.
Read-only String.
(Inherited from
XlsRange
.)
The following code illustrates how to access Address property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get RangeAddress</para><para>string address = worksheet.Range[3, 4].RangeAddress;</para>
|
|
|
RangeAddressLocal |
Returns the range reference for the specified range in the language of the user.
(Inherited from
XlsRange
.)
The following code illustrates how to access AddressLocal property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get RangeAddressLocal</para><para>string address = worksheet.Range[3, 4].RangeAddressLocal;</para>
|
|
|
RangeGlobalAddress |
Returns the range reference in the language of the macro.
(Inherited from
XlsRange
.)
The following code illustrates how to access AddressGlobal property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get RangeAddress</para><para>string address = worksheet.Range[3, 4].RangeGlobalAddress;</para>
|
|
|
RangeGlobalAddress2007 |
Gets address global in the format required by Excel 2007.
(Inherited from
XlsRange
.)
|
|
|
RangeGlobalAddressWithoutSheetName |
Return global address without worksheet name.
(Inherited from
XlsRange
.)
|
|
|
RangeR1C1Address |
Returns the range reference using R1C1 notation.
(Inherited from
XlsRange
.)
The following code illustrates how to access AddressR1C1 property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get RangeR1C1Address</para><para>string address = worksheet.Range[3, 4].RangeR1C1Address;</para>
|
|
|
RangeR1C1AddressLocal |
Returns the range reference using R1C1 notation.
(Inherited from
XlsRange
.)
The following code illustrates how to access AddressR1C1Local property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get RangeR1C1AddressLocal</para><para>string address = worksheet.Range[3, 4].RangeR1C1Address;</para>
|
|
|
ReferenceCount |
Get quantity of instance references.
(Inherited from
XlsObject
.)
|
|
|
RichText |
Returns a RichTextString object that represents the rich text style.
The following code illustrates how to set rich text formatting in the range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create style</para><para>IStyle style = workbook.Styles.Add("CustomStyle");</para><para>//Set rich text</para><para>IRichTextString richText = worksheet["C2"].RichText;</para><para>richText.Text = "Sample text";</para><para>//Set rich text font</para><para>IFont font = style.Font;</para><para>font.IsBold = true;</para><para>richText.SetFont(0, 5, font);</para><para>//Save to file</para><para>workbook.SaveToFile("RichText.xlsx");</para>
|
|
|
Row |
Returns the number of the first row of the first area in the range.
(Inherited from
XlsRange
.)
|
|
|
RowCount |
Gets number of rows.
(Inherited from
XlsRange
.)
|
|
|
RowGroupLevel |
Row group level.
(Inherited from
XlsRange
.)
|
|
|
RowHeight |
Returns the height of all the rows in the range specified, measured in points.
(Inherited from
XlsRange
.)
The following code illustrates how to set row height:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["A1"].Text = "Test";</para><para>//Set row height</para><para>worksheet["A1"].RowHeight = 30;</para><para>//Save to file</para><para>workbook.SaveToFile("RowHeight.xlsx");</para>
|
|
|
Rows |
Returns the number of the first row of the first area in the range.
The following code illustrates how to access rows:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set rows</para><para>IXLSRange[] rows = worksheet["A1:E8"].Rows;</para><para>//Do some manipulations</para><para>foreach (IXLSRange row in rows)</para><para>row.Text = row.RangeAddressLocal;</para><para>//Save to file</para><para>workbook.SaveToFile("Rows.xlsx");</para>
|
|
|
Style |
Returns a Style object that represents the style of the specified range.
The following code illustrates how to the style of the specified range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["C2"].Text = "Sample";</para><para>//Add and set style</para><para>CellStyle style = workbook.Styles.Add("BorderStyle");</para><para>style.Color = Color.Red;</para><para>worksheet["C2"].Style = style;</para><para>//Save to file</para><para>workbook.SaveToFile("Style.xlsx");</para>
|
|
|
Text |
Gets / sets text of range.
(Inherited from
XlsRange
.)
|
|
|
TimeSpanValue |
Gets or sets timespan value of cell.
(Inherited from
XlsRange
.)
|
|
|
Value |
Returns or sets the value of the specified range.
(Inherited from
XlsRange
.)
The following code illustrates how to set Value of the specified range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set value of the range</para><para>CellRange range= worksheet.Range[3, 1];</para><para>range.Value = "1/1/2015";</para><para>//Save to file</para><para>workbook.SaveToFile("Value.xlsx");</para>
|
|
|
Value2 |
Returns or sets the cell value.
It's not use for current and datetime types.
(Inherited from
XlsRange
.)
The following code illustrates how to access Value2 property of the Range:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Assigning Value2 property of the Range</para><para>worksheet["A1"].Value2 = DateTime.Now;</para><para>worksheet["A3"].Value2 = false;</para><para>//Checking Range types</para><para>Console.WriteLine(worksheet["A1"].HasDateTime);</para><para>Console.WriteLine(worksheet["A3"].HasBoolean);</para>
|
|
|
VerticalAlignment |
Returns or sets the vertical alignment of the specified object.
(Inherited from
XlsRange
.)
The following code illustrates how to set vertical alignment type:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["A1"].Text = "Test";</para><para>//Set alignment</para><para>worksheet["A1"].VerticalAlignment = VerticalAlignType.Top;</para><para>//Save to file</para><para>workbook.SaveToFile("VerticalAlignment.xlsx");</para>
|
|
|
Workbook |
Gets the workbook .
(Inherited from
XlsRange
.)
|
|
|
Worksheet |
Returns a worksheet object that represents the worksheet
containing the specified range.
|
|
|
WorksheetName |
Returns name of the parent worksheet.
(Inherited from
XlsRange
.)
|