Class XlsName
- Namespace
- Spire.Xls.Core.Spreadsheet
- Assembly
- Spire.XLS.dll
public class XlsName : XlsObject, INamedRange, IXLSRange, IExcelApplication, IEnumerable, IDisposable
- Inheritance
-
XlsName
- Implements
- Inherited Members
Properties
BooleanValue
Gets / sets boolean value that is contained by this range.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set and get BooleanValueworksheet.Range[2, 4].BooleanValue = true;bool boolean = worksheet.Range[2, 4].BooleanValue;
public bool BooleanValue { get; set; }
Property Value
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).
//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
BuiltInStyle
Gets/sets built in style.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["C2"].Text = "Sample";//Set built in styleworksheet["C2"].BuiltInStyle = BuiltInStyles.Accent3;//Save to fileworkbook.SaveToFile("BuiltInStyle.xlsx");
public BuiltInStyles? BuiltInStyle { get; set; }
Property Value
CellList
Returns a Range object that represents the cells in the specified range.
Read-only.
//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
CellStyleName
Returns name of the Style object that represents the style of the specified
range. Read/write String.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add and set styleCellStyle style = workbook.Styles.Add("CustomStyle");worksheet["C2"].Style = style;//Check Style nameConsole.Write(worksheet["C2"].CellStyleName);
public string CellStyleName { get; set; }
Property Value
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
Column
Returns the number of the first column in the first area in the specified
range. Read-only.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Get specific columnint firstColumn = worksheet["E1:R3"].Column;
public int Column { get; }
Property Value
ColumnGroupLevel
Column group level. Read-only. -1 - Not all columns in the range have same group level. 0 - No grouping, 1 - 7 - Group level.
public int ColumnGroupLevel { get; }
Property Value
ColumnWidth
Returns or sets the width of all columns in the specified range.
Read/write Double.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set the ColumnWidthworksheet["A1"].Text = "This cell contains sample text";worksheet["A1"].ColumnWidth = 25;//Save to fileworkbook.SaveToFile("ColumnWidth.xlsx");
public double ColumnWidth { get; set; }
Property Value
Columns
For a Range object, returns an array of Range objects that represent the
columns in the specified range.
//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
Comment
Comment assigned to the range. Read-only.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Adding comments to a cellworksheet.Range["A1"].AddComment().Text = "Comments";//Add Rich Text CommentsCellRange range = worksheet.Range["A6"];range.AddComment().RichText.Text = "RichText";IRichTextString rtf = range.Comment.RichText;//Formatting first 4 charactersIFont redFont = workbook.CreateFont();redFont.IsBold = true;redFont.Color = Color.Red;rtf.SetFont(0, 3, redFont);//Save to fileworkbook.SaveToFile("DataValidation.xlsx");
public ICommentShape Comment { get; }
Property Value
CommentValue
public string CommentValue { get; }
Property Value
ConditionalFormats
Collection of conditional formats.
public ConditionalFormats ConditionalFormats { get; }
Property Value
Count
Returns the number of objects in the collection. Read-only.
public int Count { get; }
Property Value
DataValidation
Data validation for the range.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Data validation for numberIDataValidation validation = worksheet.Range["A3"].DataValidation;validation.AllowType = CellDataType.Integer;//Value between 0 to 10validation.CompareOperator = ValidationComparisonOperator.Between;validation.Formula1 = "0";validation.Formula2 = "10";//Save to fileworkbook.SaveToFile("DataValidation.xlsx");
public Validation DataValidation { get; }
Property Value
DateTimeValue
Gets / sets DateTime contained by this cell. Read-write DateTime.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set and get the DateTimeValue of specified rangeworksheet.Range[2, 4].DateTimeValue = DateTime.Now;DateTime dateTime = worksheet.Range[2, 4].DateTimeValue;//Save to fileworkbook.SaveToFile("DateTimeValue.xlsx");
public DateTime DateTimeValue { get; set; }
Property Value
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
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
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
EnvalutedValue
Returns the calculated value of a formula.
public string EnvalutedValue { get; }
Property Value
ErrorValue
Gets / sets error value that is contained by this range.
public string ErrorValue { get; set; }
Property Value
Formula
Returns or sets the object's formula in A1-style notation and in the language of the macro. Read/write Variant.
public string Formula { get; set; }
Property Value
FormulaArray
Represents array-entered formula.
Visit http://www.cpearson.com/excel/array.htm for more information.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Assign array formulaworksheet.Range["A1:D1"].FormulaArray = "{1,2,3,4}";//Adding a named range for the range A1 to D1worksheet.Names.Add("ArrayRange", worksheet.Range["A1:D1"]);//Assign formula array with named rangeworksheet.Range["A2:D2"].FormulaArray = "ArrayRange+100";//Save to fileworkbook.SaveToFile("FormulaArray.xlsx");
public string FormulaArray { get; set; }
Property Value
FormulaArrayR1C1
Returns or sets the formula array for the range, using R1C1-style notation.
public string FormulaArrayR1C1 { get; set; }
Property Value
FormulaBoolValue
Returns the calculated value of the formula as a boolean.
public bool FormulaBoolValue { get; set; }
Property Value
FormulaDateTime
Get / set formula DateTime value contained by this cell. DateTime.MinValue if not all cells of the range have same DateTime value.
public DateTime FormulaDateTime { get; set; }
Property Value
FormulaErrorValue
Returns the calculated value of the formula as a string.
public string FormulaErrorValue { get; set; }
Property Value
FormulaNumberValue
Gets / sets number value evaluated by formula.
public double FormulaNumberValue { get; set; }
Property Value
FormulaR1C1
Returns or sets the formula for the range, using R1C1-style notation.
public string FormulaR1C1 { get; set; }
Property Value
FormulaStringValue
Gets / sets string value evaluated by formula.
public string FormulaStringValue { get; set; }
Property Value
HasBoolean
Indicates whether range contains bool value. Read-only.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Assigning Value2 property of the Rangeworksheet["A3"].Value2 = false;//Checking Range typesbool isboolean = worksheet["A3"].HasBoolean;//Save to fileworkbook.SaveToFile("HasBoolean.xlsx");
public bool HasBoolean { get; }
Property Value
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
HasDateTime
Indicates whether range contains DateTime value. Read-only.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Assigning Value2 property of the Rangeworksheet["A1"].Value2 = DateTime.Now;//Checking Range typesbool isDateTime = worksheet["A1"].HasDateTime;//Save to fileworkbook.SaveToFile("HasDateTime.xlsx");
public bool HasDateTime { get; }
Property Value
HasError
Indicates whether range contains error value.
public bool HasError { get; }
Property Value
HasExternalFormula
Indicates is current range has external formula. Read-only.
public bool HasExternalFormula { get; }
Property Value
HasFormula
True if all cells in the range contain formulas; False if at least one of the cells in the range doesn't contain a formula. Read-only Boolean.
public bool HasFormula { get; }
Property Value
HasFormulaArray
Indicates whether range contains array-entered formula. Read-only.
public bool HasFormulaArray { get; }
Property Value
HasFormulaBoolValue
Indicates if current range has formula bool value. Read only.
public bool HasFormulaBoolValue { get; }
Property Value
HasFormulaDateTime
Indicates if current range has formula value formatted as DateTime. Read-only.
public bool HasFormulaDateTime { get; }
Property Value
HasFormulaErrorValue
Indicates if current range has formula error value. Read only.
public bool HasFormulaErrorValue { get; }
Property Value
HasFormulaNumberValue
Indicates if the current range has formula number value. Read-only.
public bool HasFormulaNumberValue { get; }
Property Value
HasFormulaStringValue
Indicates if the current range has formula string value. Read-only.
public bool HasFormulaStringValue { get; }
Property Value
HasMerged
Indicates whether this range is part of merged range. Read-only.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["A1"].Text = "Sample text in cell";//Set mergeworksheet["A1:B1"].Merge();//Check mergeConsole.Write(worksheet["A1:B1"].HasMerged);
public bool HasMerged { get; }
Property Value
HasNumber
Indicates whether the range contains number. Read-only.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Assigning Value2 property of the Rangeworksheet["A2"].Value2 = 45;//Checking Range typesbool isNumber = worksheet["A2"].HasNumber;//Save to fileworkbook.SaveToFile("HasNumber.xlsx");
public bool HasNumber { get; }
Property Value
HasRichText
Indicates whether cell contains formatted rich text string.
//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";IFont font = style.Font;font.Color = Color.Red;richText.SetFont(0, 5, font);//Check HasRichTextConsole.Write(worksheet["C2"].HasRichText);//Save to fileworkbook.SaveToFile("HasRichText.xlsx");
public bool HasRichText { get; }
Property Value
HasString
Indicates whether the range contains String. Read-only.
public bool HasString { get; }
Property Value
HasStyle
Indicates whether range has default style. False means default style.
Read-only.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add styleCellStyle style = workbook.Styles.Add("CustomStyle");//Set color and stylestyle.Color = Color.Red;worksheet["C2"].Style = style;//Check HasStyleConsole.Write(worksheet["C2"].HasStyle);//Save to fileworkbook.SaveToFile("HasStyle.xlsx");
public bool HasStyle { get; }
Property Value
HorizontalAlignment
Returns or sets the horizontal alignment for the specified object.
Read/write HorizontalAlignType.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["A1"].Text = "Test";//Set alignmentworksheet["A1"].HorizontalAlignment = HorizontalAlignType.Right;//Save to fileworkbook.SaveToFile("HorizontalAlignment.xlsx");
public HorizontalAlignType HorizontalAlignment { get; set; }
Property Value
HtmlString
Gets and sets the html string which contains data and some formattings in this cell.
public string HtmlString { get; set; }
Property Value
Hyperlinks
Returns hyperlinks for this range.
public IHyperLinks Hyperlinks { get; }
Property Value
IgnoreErrorOptions
Represents ignore error options. If not single cell returs concatenateed flags.
public IgnoreErrorType IgnoreErrorOptions { get; set; }
Property Value
IndentLevel
Returns or sets the indent level for the cell or range. Can be an
integer from 0 to 15. Read/write Integer.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["C2"].Text = "Sample";//Set indent levelworksheet["C2"].IndentLevel = 2;//Save to fileworkbook.SaveToFile("IndentLevel.xlsx");
public int IndentLevel { get; set; }
Property Value
Index
public int Index { get; }
Property Value
IsBlank
Indicates whether the range is blank. Read-only.
public bool IsBlank { get; }
Property Value
IsBuiltIn
public bool IsBuiltIn { get; set; }
Property Value
IsExternName
[Obsolete("get and set are not implemented")]
public bool IsExternName { get; }
Property Value
IsFormulaHidden
True if the formula will be hidden when the worksheet is protected. False if at least part of formula in the range is not hidden.
public bool IsFormulaHidden { get; set; }
Property Value
IsFunction
public bool IsFunction { get; set; }
Property Value
IsGroupedByColumn
Indicates whether this range is grouped by column. Read-only.
public bool IsGroupedByColumn { get; }
Property Value
IsGroupedByRow
Indicates whether this range is grouped by row. Read-only.
public bool IsGroupedByRow { get; }
Property Value
IsInitialized
Indicates whether cell is initialized. Read-only.
public bool IsInitialized { get; }
Property Value
IsLocal
public bool IsLocal { get; }
Property Value
IsStringsPreserved
Indicates whether all values in the range are preserved as strings.
public bool? IsStringsPreserved { get; set; }
Property Value
- bool?
IsWrapText
True if Microsoft Excel wraps the text in the object.
Read/write Boolean.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["A1"].Text = "This cell contains sample text";//Set wrap textworksheet["A1"].IsWrapText = true;//Save to fileworkbook.SaveToFile("IsWrapText.xlsx");
public bool IsWrapText { get; set; }
Property Value
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
Property Value
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
Property Value
this[string]
Get cell range. Read-only.
public IXLSRange this[string name] { get; }
Parameters
name
string
Property Value
this[string, bool]
Gets cell range. Read-only.
public IXLSRange this[string name, bool IsR1C1Notation] { get; }
Parameters
Property Value
LastColumn
Returns last column of the range. Read-only.
public int LastColumn { get; set; }
Property Value
LastRow
Returns last row of the range. Read-only.
public int LastRow { get; set; }
Property Value
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.
//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
Name
public string Name { get; set; }
Property Value
NameLocal
public string NameLocal { get; set; }
Property Value
NumberFormat
Format of current cell. Analog of Style.NumberFormat property.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set dataworksheet["C2"].Value = "3100.23";//Set number formatworksheet["C2"].NumberFormat = "#,##1.##";//Save to fileworkbook.SaveToFile("NumberFormat.xlsx");
public string NumberFormat { get; set; }
Property Value
NumberText
Returns cell value after number format application. Read-only.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Gets cell value with its number formatCellRange range= worksheet.Range[3, 1];range.Value = "1/1/2015";range.NumberFormat = "dd-MMM-yyyy";string numberText = range.NumberText;//Save to fileworkbook.SaveToFile("NumberText.xlsx");
public string NumberText { get; }
Property Value
NumberValue
Gets / sets double value of the range.
public double NumberValue { get; set; }
Property Value
RangeAddress
Returns the range reference in the language of the macro.
Read-only String.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Get RangeAddressstring address = worksheet.Range[3, 4].RangeAddress;
public string RangeAddress { get; }
Property Value
RangeAddressLocal
Returns the range reference for the specified range in the language
of the user. Read-only String.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Get RangeAddressLocalstring address = worksheet.Range[3, 4].RangeAddressLocal;
public string RangeAddressLocal { get; }
Property Value
RangeGlobalAddress
Returns range Address in format "'Sheet1'!$A$1".
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Get RangeAddressstring address = worksheet.Range[3, 4].RangeGlobalAddress;
public string RangeGlobalAddress { get; }
Property Value
RangeGlobalAddress2007
public string RangeGlobalAddress2007 { get; }
Property Value
RangeR1C1Address
Returns the range reference using R1C1 notation.
Read-only String.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Get RangeR1C1Addressstring address = worksheet.Range[3, 4].RangeR1C1Address;
public string RangeR1C1Address { get; }
Property Value
RangeR1C1AddressLocal
Returns the range reference using R1C1 notation.
Read-only String.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Get RangeR1C1AddressLocalstring address = worksheet.Range[3, 4].RangeR1C1Address;
public string RangeR1C1AddressLocal { get; }
Property Value
RefersToRange
public IXLSRange RefersToRange { get; set; }
Property Value
RichText
String with rich text formatting. Read-only.
//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
Row
Returns the number of the first row of the first area in the range. Read-only Long.
public int Row { get; }
Property Value
RowGroupLevel
Row group level. Read-only. -1 - Not all rows in the range have same group level. 0 - No grouping, 1 - 7 - Group level.
public int RowGroupLevel { get; }
Property Value
RowHeight
Returns the height of all the rows in the range specified,
measured in points. Returns Double.MinValue if the rows in the specified range
aren't all the same height. Read / write Double.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["A1"].Text = "Test";//Set row heightworksheet["A1"].RowHeight = 30;//Save to fileworkbook.SaveToFile("RowHeight.xlsx");
public double RowHeight { get; set; }
Property Value
Rows
For a Range object, returns an array of Range objects that represent the
rows in the specified range.
//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
Scope
public string Scope { get; }
Property Value
Style
Returns a Style object that represents the style of the specified
range. Read/write IStyle.
//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
Text
Gets / sets string value of the range.
public string Text { get; set; }
Property Value
TimeSpanValue
Gets / sets time value of the range.
public TimeSpan TimeSpanValue { get; set; }
Property Value
Value
public string Value { get; set; }
Property Value
Value2
Returns or sets the cell value. Read/write Variant.
The only difference between this property and the Value property is
that the Value2 property doesn't use the Currency and Date data types.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Assigning Value2 property of the Rangeworksheet["A1"].Value2 = DateTime.Now;worksheet["A3"].Value2 = false;//Checking Range typesConsole.WriteLine(worksheet["A1"].HasDateTime);Console.WriteLine(worksheet["A3"].HasBoolean);
public object Value2 { get; set; }
Property Value
ValueR1C1
public string ValueR1C1 { get; }
Property Value
VerticalAlignment
Returns or sets the vertical alignment of the specified object.
Read/write VerticalAlignType.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["A1"].Text = "Test";//Set alignmentworksheet["A1"].VerticalAlignment = VerticalAlignType.Top;//Save to fileworkbook.SaveToFile("VerticalAlignment.xlsx");
public VerticalAlignType VerticalAlignment { get; set; }
Property Value
Visible
public bool Visible { get; set; }
Property Value
Worksheet
public IWorksheet Worksheet { get; }
Property Value
Methods
Activate()
public IXLSRange Activate()
Returns
Activate(bool)
public IXLSRange Activate(bool scroll)
Parameters
scroll
bool
Returns
AddComment()
public ICommentShape AddComment()
Returns
AutoFitColumns()
Autofits all columns in the range.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Auto-fit columnsworksheet.Range["B4"].Text = "Fit the content to column";worksheet.Range["B4"].AutoFitColumns();//Save to fileworkbook.SaveToFile("AutoFitRows.xlsx");
public void AutoFitColumns()
AutoFitRows()
Autofits all rows in the range.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Auto-fit rowsworksheet.Range["A2"].Text = "Fit the content to row";worksheet.Range["A2"].IsWrapText = true;worksheet.Range["A2"].AutoFitRows();//Save to fileworkbook.SaveToFile("AutoFitRows.xlsx");
public void AutoFitRows()
BorderAround()
Sets around border for current range.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["C2"].Text = "Sample";worksheet["D2"].Text = "text";worksheet["C3"].Text = "in";worksheet["D3"].Text = "cell";//Set borderworksheet["C2:D3"].BorderAround();//Save to fileworkbook.SaveToFile("BorderAround.xlsx");
public void BorderAround()
BorderAround(LineStyleType)
public void BorderAround(LineStyleType borderLine)
Parameters
borderLine
LineStyleType
BorderAround(LineStyleType, ExcelColors)
public void BorderAround(LineStyleType borderLine, ExcelColors borderColor)
Parameters
borderLine
LineStyleTypeborderColor
ExcelColors
BorderAround(LineStyleType, Color)
public void BorderAround(LineStyleType borderLine, Color borderColor)
Parameters
borderLine
LineStyleTypeborderColor
Color
BorderInside()
Sets inside border for current range.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["C2"].Text = "Sample";worksheet["D2"].Text = "text";worksheet["C3"].Text = "in";worksheet["D3"].Text = "cell";//Set borderworksheet["C2:D3"].BorderInside();//Save to fileworkbook.SaveToFile("BorderInside.xlsx");
public void BorderInside()
BorderInside(LineStyleType)
public void BorderInside(LineStyleType borderLine)
Parameters
borderLine
LineStyleType
BorderInside(LineStyleType, ExcelColors)
public void BorderInside(LineStyleType borderLine, ExcelColors borderColor)
Parameters
borderLine
LineStyleTypeborderColor
ExcelColors
BorderInside(LineStyleType, Color)
public void BorderInside(LineStyleType borderLine, Color borderColor)
Parameters
borderLine
LineStyleTypeborderColor
Color
BorderNone()
Sets none border for current range.
//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Remove bordersworksheet["C2"].BorderNone();//Save to fileworkbook.SaveToFile("BorderNone.xlsx");
public void BorderNone()
Clear(ExcelClearOptions)
public void Clear(ExcelClearOptions option)
Parameters
option
ExcelClearOptions
Clear(bool)
public void Clear(bool isClearFormat)
Parameters
isClearFormat
bool
ClearContents()
Clear the contents of the Range.
//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Clears the Range C2worksheet.Range["C2"].ClearContents();//Save to fileworkbook.SaveToFile("ClearContents.xlsx");
public void ClearContents()
Clone(object)
public object Clone(object parent)
Parameters
parent
object
Returns
Clone(object, Dictionary<string, string>, XlsWorkbook)
[Obsolete("the method is not implemented")]
public IXLSRange Clone(object parent, Dictionary<string, string> hashNewNames, XlsWorkbook book)
Parameters
parent
objecthashNewNames
Dictionary<string, string>book
XlsWorkbook
Returns
CollapseGroup(GroupByType)
public void CollapseGroup(GroupByType groupBy)
Parameters
groupBy
GroupByType
ConvertFullRowColumnName(ExcelVersion)
[Obsolete("the method is not implemented")]
public void ConvertFullRowColumnName(ExcelVersion version)
Parameters
version
ExcelVersion
CopyTo(IXLSRange)
public IXLSRange CopyTo(IXLSRange destination)
Parameters
destination
IXLSRange
Returns
Delete()
public void Delete()
ExpandGroup(GroupByType)
public void ExpandGroup(GroupByType groupBy)
Parameters
groupBy
GroupByType
ExpandGroup(GroupByType, ExpandCollapseFlags)
public void ExpandGroup(GroupByType groupBy, ExpandCollapseFlags flags)
Parameters
groupBy
GroupByTypeflags
ExpandCollapseFlags
ExportDataTable(ExportTableOptions)
public DataTable ExportDataTable(ExportTableOptions options)
Parameters
options
ExportTableOptions
Returns
FindAll(bool)
public CellRange[] FindAll(bool findValue)
Parameters
findValue
bool
Returns
FindAll(DateTime)
public CellRange[] FindAll(DateTime findValue)
Parameters
findValue
DateTime
Returns
FindAll(double, FindType)
public CellRange[] FindAll(double findValue, FindType flags)
Parameters
Returns
FindAll(string, FindType)
public List<CellRange> FindAll(string findValue, FindType flags)
Parameters
Returns
FindAll(TimeSpan)
public CellRange[] FindAll(TimeSpan findValue)
Parameters
findValue
TimeSpan
Returns
FindFirst(bool)
public IXLSRange FindFirst(bool findValue)
Parameters
findValue
bool
Returns
FindFirst(DateTime)
public IXLSRange FindFirst(DateTime findValue)
Parameters
findValue
DateTime
Returns
FindFirst(double, FindType)
public IXLSRange FindFirst(double findValue, FindType flags)
Parameters
Returns
FindFirst(string, FindType)
public IXLSRange FindFirst(string findValue, FindType flags)
Parameters
Returns
FindFirst(TimeSpan)
public IXLSRange FindFirst(TimeSpan findValue)
Parameters
findValue
TimeSpan
Returns
FreezePanes()
Freezes pane at the current range.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Applying Freeze Pane to the sheet by specifying a cellworksheet.Range["B2"].FreezePanes();//Save to fileworkbook.SaveToFile("FreezePanes.xlsx");
public void FreezePanes()
GetEnumerator()
public IEnumerator GetEnumerator()
Returns
Intersect(IXLSRange)
public IXLSRange Intersect(IXLSRange range)
Parameters
range
IXLSRange
Returns
Merge()
Creates a merged cell from the specified Range object.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["A1"].Text = "Merged cell";//Merge cellsworksheet["A1:B1"].Merge();//Save to fileworkbook.SaveToFile("Merge.xlsx");
public void Merge()
Merge(IXLSRange)
public IXLSRange Merge(IXLSRange range)
Parameters
range
IXLSRange
Returns
Merge(bool)
public void Merge(bool clearCells)
Parameters
clearCells
bool
SetIndex(int)
[Obsolete("the method is not implemented")]
public void SetIndex(int index)
Parameters
index
int
SetIndex(int, bool)
[Obsolete("the method is not implemented")]
public void SetIndex(int index, bool bRaiseEvent)
Parameters
UnMerge()
Separates a merged area into individual cells.
//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Set textworksheet["A1"].Text = "Merged cell";//Merge cellsworksheet["A1:B1"].Merge(true);//Unmerge cellsworksheet["A1:B1"].UnMerge();//Save to fileworkbook.SaveToFile("UnMerge.xlsx");
public void UnMerge()