Cells Class
Encapsulates a collection of cell relevant objects, such as Cell, Row, ...etc.
Inheritance Hierarchy
SystemObject
  Aspose.CellsCells

Namespace: Aspose.Cells
Assembly: Aspose.Cells (in Aspose.Cells.dll) Version: 19.11.0.0 (19.11)
Syntax
public class Cells : IEnumerable, IDisposable

The Cells type exposes the following members.

Properties
  NameDescription
Public propertyColumns
Gets the collection of Column objects that represents the individual columns in this worksheet.
Public propertyCount
Gets the total count of instantiated Cell objects.
Public propertyCountLarge
Gets the total count of instantiated Cell objects.
Public propertyFirstCell
Gets the first cell in this worksheet.
Public propertyIsDefaultRowHeightMatched
Indicates that row height and default font height matches
Public propertyIsDefaultRowHidden
Indicates whether the row is defaultly hidden.
Public propertyItemInt32 Obsolete.
Gets Cell item within the worksheet
Public propertyCode exampleItemString
Gets the Cell element at the specified cell name.
Public propertyCode exampleItemInt32, Int32
Gets the Cell element at the specified cell row index and column index.
Public propertyLastCell
Gets the last cell in this worksheet.
Public propertyMaxColumn
Maximum column index of cell which contains data or style.
Public propertyMaxDataColumn
Maximum column index of cell which contains data.
Public propertyMaxDataRow
Maximum row index of cell which contains data.
Public propertyMaxDisplayRange
Gets the max range which includes data, merged cells and shapes.
Public propertyMaxRow
Maximum row index of cell which contains data or style.
Public propertyMemorySetting
Gets or sets the memory usage option for this cells.
Public propertyMergedCells
Gets the collection of merged cells.
Public propertyMinColumn
Minimum column index of cell which contains data or style.
Public propertyMinDataColumn
Minimum column index of cell which contains data.
Public propertyMinDataRow
Minimum row index of cell which contains data.
Public propertyMinRow
Minimum row index of cell which contains data or style.
Public propertyMultiThreadReading
Gets or sets whether the cells data model should support Multi-Thread reading. Default value of this property is false. If there are multiple threads to read Row/Cell objects in this collection concurrently, this property should be set as true, otherwise unexpected result may be produced. Supporting Multi-Thread reading may degrade the performance for accessing Row/Cell objects from this collection.
Public propertyOdsCellFields
Gets the list of fields of ods.
Public propertyPreserveString
Gets or sets a value indicating whether all worksheet values are preserved as strings. Default is false.
Public propertyRanges
Gets the collection of Range objects created at run time.
Public propertyRows
Gets the collection of Row objects that represents the individual rows in this worksheet.
Public propertyStandardHeight
Gets or sets the default row height in this worksheet, in unit of points.
Public propertyStandardHeightPixels
Gets or sets the default row height in this worksheet, in unit of pixels.
Public propertyStandardWidth
Gets or sets the default column width in the worksheet, in unit of characters.
Public propertyStandardWidthInch
Gets or sets the default column width in the worksheet, in unit of inches.
Public propertyStandardWidthPixels
Gets or sets the default column width in the worksheet, in unit of pixels.
Public propertyStyle
Gets and sets the default style.
Methods
  NameDescription
Public methodAddRange
Adds a range object reference to cells
Public methodApplyColumnStyle
Applies formats for a whole column.
Public methodApplyRowStyle
Applies formats for a whole row.
Public methodApplyStyle
Applies formats for a whole worksheet.
Public methodCheckCell
Gets the Cell element or null at the specified cell row index and column index.
Public methodCheckColumn
Gets the Column element or null at the specified column index.
Public methodCheckRow
Gets the Row element or at the specified cell row index.
Public methodClear
Clears all cell and row objects.
Public methodClearContents(CellArea)
Clears contents of a range.
Public methodClearContents(Int32, Int32, Int32, Int32)
Clears contents of a range.
Public methodClearFormats(CellArea)
Clears formatting of a range.
Public methodClearFormats(Int32, Int32, Int32, Int32)
Clears formatting of a range.
Public methodClearRange(CellArea)
Clears contents and formatting of a range.
Public methodClearRange(Int32, Int32, Int32, Int32)
Clears contents and formatting of a range.
Public methodConvertStringToNumericValue
Converts string data in cells to numeric value if possible.
Public methodCopyColumn
Copies data and formats of a whole column.
Public methodCopyColumns(Cells, Int32, Int32, Int32)
Copies data and formats of a whole column.
Public methodCopyColumns(Cells, Int32, Int32, Int32, PasteOptions)
Copies data and formats of a whole column.
Public methodCopyColumns(Cells, Int32, Int32, Int32, Int32)
Copies data and formats of the whole columns.
Public methodCopyRow
Copies data and formats of a whole row.
Public methodCopyRows(Cells, Int32, Int32, Int32)
Copies data and formats of some whole rows.
Public methodCopyRows(Cells, Int32, Int32, Int32, CopyOptions)
Copies data and formats of some whole rows.
Public methodCopyRows(Cells, Int32, Int32, Int32, CopyOptions, PasteOptions)
Copies data and formats of some whole rows.
Public methodCreateRange(String)
Creates a Range object from an address of the range.
Public methodCreateRange(String, String)
Creates a Range object from a range of cells.
Public methodCreateRange(Int32, Int32, Boolean)
Creates a Range object from rows of cells or columns of cells.
Public methodCreateRange(Int32, Int32, Int32, Int32)
Creates a Range object from a range of cells.
Public methodDeleteBlankColumns
Delete all blank columns which do not contain any data.
Public methodDeleteBlankColumns(DeleteOptions)
Delete all blank columns which do not contain any data.
Public methodDeleteBlankRows
Delete all blank rows which do not contain any data.
Public methodDeleteBlankRows(DeleteOptions)
Delete all blank rows which do not contain any data.
Public methodDeleteColumn(Int32)
Deletes a column.
Public methodDeleteColumn(Int32, Boolean)
Deletes a column.
Public methodDeleteColumns
Deletes several columns.
Public methodDeleteRange
Deletes a range of cells and shift cells according to the shift option.
Public methodDeleteRow
Deletes a row.
Public methodDeleteRows(Int32, Int32)
Deletes several rows.
Public methodDeleteRows(Int32, Int32, Boolean)
Deletes multiple rows in the worksheet.
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public methodEndCellInColumn(Int16)
Gets the last cell in this column.
Public methodEndCellInColumn(Int32, Int32, Int16, Int16)
Gets the last cell with maximum column index in this range.
Public methodEndCellInRow(Int32)
Gets the last cell in this row.
Public methodEndCellInRow(Int32, Int32, Int32, Int32)
Gets the last cell with maximum row index in this range.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodExportArray
Exports data in the Cells collection to a two-dimension array object.
Public methodCode exampleExportDataTable(Int32, Int32, Int32, Int32)
Exports data in the Cells collection to a DataTable object.
Public methodExportDataTable(Int32, Int32, Int32, Int32, ExportTableOptions)
Exports data in the Cells collection to a DataTable object.
Public methodExportDataTable(Int32, Int32, Int32, Int32, Boolean)
Exports data in the Cells collection to a DataTable object.
Public methodExportDataTableAsString(Int32, Int32, Int32, Int32)
Exports data in the Cells collection to a DataTable object.
Public methodExportDataTableAsString(Int32, Int32, Int32, Int32, Boolean)
Exports data in the Cells collection to a DataTable object.
Public methodExportTypeArray
Exports cell value type in the Cells collection to a two-dimension array object.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFind(Object, Cell)
Finds the cell containing with the input object.
Public methodFind(Object, Cell, FindOptions)
Finds the cell containing with the input object.
Public methodFindFormula Obsolete.
Finds the cell with the input string.
Public methodFindFormulaContains Obsolete.
Finds the cell with formla which contains the input string.
Public methodGetCell
Gets the Cell element or null at the specified cell row index and column index.
Public methodGetCellStyle
Get the style of given cell.
Public methodGetColumnWidth
Gets the width of the specified column in normal view
Public methodGetColumnWidthInch
Gets the width of the specified column in normal view, in units of inches.
Public methodGetColumnWidthPixel
Gets the width of the specified column in normal view, in units of pixel.
Public methodGetDependents
Get all cells which refer to the specific cell.
Public methodGetEnumerator
Gets the cells enumerator.
Public methodGetGroupedColumnOutlineLevel
Gets the outline level (zero-based) of the column.
Public methodGetGroupedRowOutlineLevel
Gets the outline level (zero-based) of the row.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetLastDataRow
Gets the last row index of cell which contains data in the specified column.
Public methodGetMaxGroupedColumnOutlineLevel
Gets the max grouped column outline level (zero-based).
Public methodGetMaxGroupedRowOutlineLevel
Gets the max grouped row outline level (zero-based).
Public methodGetRow
Gets the Row element at the specified cell row index.
Public methodGetRowEnumerator
Gets the rows enumerator
Public methodGetRowHeight
Gets the height of a specified row.
Public methodGetRowHeightInch
Gets the height of a specified row in unit of inches.
Public methodGetRowHeightPixel
Gets the height of a specified row in unit of pixel.
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodGetViewColumnWidthPixel
Get the width in different view type.
Public methodGroupColumns(Int32, Int32)
Groups columns.
Public methodGroupColumns(Int32, Int32, Boolean)
Groups columns.
Public methodGroupRows(Int32, Int32)
Groups rows.
Public methodGroupRows(Int32, Int32, Boolean)
Groups rows.
Public methodHideColumn
Hides a column.
Public methodHideColumns
Hide multiple columns.
Public methodHideGroupDetail
Collapses the grouped rows/columns.
Public methodHideRow
Hides a row.
Public methodHideRows
Hides multiple rows.
Public methodImport Obsolete.
Import data from data view.
Public methodImportArray(Double, Int32, Int32)
Imports a two-dimension array of double into a worksheet.
Public methodImportArray(Int32, Int32, Int32)
Imports a two-dimension array of integer into a worksheet.
Public methodImportArray(String, Int32, Int32)
Imports a two-dimension array of string into a worksheet.
Public methodImportArray(Double, Int32, Int32, Boolean)
Imports an array of double into a worksheet.
Public methodImportArray(Int32, Int32, Int32, Boolean)
Imports an array of integer into a worksheet.
Public methodImportArray(String, Int32, Int32, Boolean)
Imports an array of string into a worksheet.
Public methodImportArrayList
Imports an arraylist of data into a worksheet.
Public methodImportCSV(Stream, TxtLoadOptions, Int32, Int32)
Import a CSV file to the cells.
Public methodImportCSV(String, TxtLoadOptions, Int32, Int32)
Import a CSV file to the cells.
Public methodImportCSV(Stream, String, Boolean, Int32, Int32)
Import a CSV file to the cells.
Public methodImportCSV(String, String, Boolean, Int32, Int32)
Import a CSV file to the cells.
Public methodImportCustomObjects(ICollection, Int32, Int32, ImportTableOptions)
Imports custom objects.
Public methodImportCustomObjects(ICollection, String, Boolean, Int32, Int32, Int32, Boolean, String, Boolean)
Imports custom objects.
Public methodImportData(IDataReader, Int32, Int32)
Imports data from a IDataReader object.
Public methodImportData(DataTable, Int32, Int32, ImportTableOptions)
Import data from custom data table.
Public methodImportData(DataView, Int32, Int32, ImportTableOptions)
Import data from data view.
Public methodImportData(IDataReader, Int32, Int32, ImportTableOptions)
Imports data from a IDataReader object.
Public methodImportData(ICellsDataTable, Int32, Int32, ImportTableOptions)
Import data from custom data table.
Public methodImportDataGrid(DataGrid, Int32, Int32, Boolean)
Imports a DataGrid into a worksheet.
Public methodImportDataGrid(DataGrid, Int32, Int32, Int32, Int32, Boolean)
Imports a DataGrid into a worksheet.
Public methodImportDataGrid(DataGrid, Int32, Int32, Int32, Int32, Boolean, Boolean)
Imports a DataGrid into a worksheet.
Public methodImportDataGridAsString
Imports a DataGrid into a worksheet. This method doesn't try to convert text into numeric values.
Public methodImportDataReader(OleDbDataReader, Int32, Int32, Boolean) Obsolete.
Imports data from a OleDbDataReader object.
Public methodImportDataReader(SqlDataReader, Int32, Int32, Boolean) Obsolete.
Imports data from a SqlDataReader object.
Public methodImportDataReader(OleDbDataReader, Boolean, Int32, Int32, Boolean) Obsolete.
Imports data from a OleDbDataReader object.
Public methodImportDataReader(SqlDataReader, Boolean, Int32, Int32, Boolean) Obsolete.
Imports data from a SqlDataReader object.
Public methodImportDataReader(IDataReader, Boolean, Int32, Int32, Boolean, String, Boolean) Obsolete.
Imports data from a IDataReader object.
Public methodImportDataReader(OleDbDataReader, Boolean, Int32, Int32, Boolean, String, Boolean) Obsolete.
Imports data from a OleDbDataReader object.
Public methodImportDataReader(SqlDataReader, Boolean, Int32, Int32, Boolean, String, Boolean) Obsolete.
Imports data from a SqlDataReader object.
Public methodImportDataRow
Imports a DataRow into the Excel file.
Public methodImportDataTable(DataTable, Boolean, String) Obsolete.
Imports a DataTable object into a worksheet.
Public methodImportDataTable(DataTable, Boolean, Int32, Int32) Obsolete.
Imports a DataTable object into a worksheet.
Public methodImportDataTable(DataTable, Boolean, Int32, Int32, Boolean) Obsolete.
Imports a DataTable object into a worksheet.
Public methodImportDataTable(DataTable, Boolean, Int32, Int32, Boolean, Boolean) Obsolete.
Imports a DataTable object into a worksheet.
Public methodCode exampleImportDataTable(DataTable, Boolean, Int32, Int32, Int32, Int32) Obsolete.
Imports a DataTable into a worksheet.
Public methodImportDataTable(DataTable, Boolean, Int32, Int32, Int32, Int32, Boolean) Obsolete.
Imports a DataTable into a worksheet.
Public methodImportDataTable(DataTable, Boolean, Int32, Int32, Int32, Int32, Boolean, String) Obsolete.
Imports a DataTable into a worksheet.
Public methodImportDataTable(DataTable, Boolean, Int32, Int32, Int32, Int32, Boolean, String, Boolean) Obsolete.
Imports a DataTable into a worksheet.
Public methodImportDataView(DataView, Int32, Int32)
Imports a DataView into a worksheet.
Public methodImportDataView(DataView, Int32, Int32, Boolean) Obsolete.
Public methodImportDataView(DataView, Boolean, Int32, Int32, Boolean) Obsolete.
Imports a DataView into a worksheet.
Public methodImportDataView(DataView, Int32, Int32, Int32, Int32) Obsolete.
Imports a DataView into a worksheet.
Public methodImportDataView(DataView, Int32, Int32, Int32, Int32, Boolean) Obsolete.
Imports a DataView into a worksheet.
Public methodImportDataView(DataView, Boolean, Int32, Int32, Int32, Int32, Boolean) Obsolete.
Imports a DataView into a worksheet.
Public methodImportDataView(DataView, Boolean, Int32, Int32, Int32, Int32, Boolean, String) Obsolete.
Imports a DataView into a worksheet.
Public methodImportFormulaArray
Imports an array of formula into a worksheet.
Public methodImportFromDataReader(OleDbDataReader, Int32, Int32, Boolean) Obsolete.
Imports data from a OleDbDataReader object.
Public methodImportFromDataReader(SqlDataReader, Int32, Int32, Boolean) Obsolete.
Imports data from a SqlDataReader object.
Public methodImportFromDataReader(OleDbDataReader, Boolean, Int32, Int32, Boolean) Obsolete.
Imports data from a OleDbDataReader object.
Public methodImportFromDataReader(SqlDataReader, Boolean, Int32, Int32, Boolean) Obsolete.
Imports data from a SqlDataReader object.
Public methodImportFromDataReader(OleDbDataReader, Boolean, Int32, Int32, Boolean, String, Boolean) Obsolete.
Imports data from a OleDbDataReader object.
Public methodImportFromDataReader(SqlDataReader, Boolean, Int32, Int32, Boolean, String, Boolean) Obsolete.
Imports data from a SqlDataReader object.
Public methodImportGridView
Imports a grid view to this cells.
Public methodImportObjectArray(Object, Int32, Int32, Boolean)
Imports an array of data into a worksheet.
Public methodImportObjectArray(Object, Int32, Int32, Boolean, Int32)
Imports an array of data into a worksheet.
Public methodImportTwoDimensionArray(Object, Int32, Int32)
Imports a two-dimension array of data into a worksheet.
Public methodImportTwoDimensionArray(Object, Int32, Int32, Boolean)
Imports a two-dimension array of data into a worksheet.
Public methodImportTwoDimensionArray(Object, Object, Int32, Int32, TxtLoadOptions)
Imports a two-dimension array of data into a worksheet.
Public methodImportTwoDimensionArray(Object, Object, Int32, Int32, Boolean)
Imports a two-dimension array of data into a worksheet.
Public methodInsertColumn(Int32)
Inserts a new column into the worksheet.
Public methodInsertColumn(Int32, Boolean)
Inserts a new column into the worksheet.
Public methodInsertColumns(Int32, Int32)
Inserts some columns into the worksheet.
Public methodInsertColumns(Int32, Int32, Boolean)
Inserts some columns into the worksheet.
Public methodInsertCutCells
Insert cut range.
Public methodInsertRange(CellArea, ShiftType)
Inserts a range of cells and shift cells according to the shift option.
Public methodInsertRange(CellArea, Int32, ShiftType)
Inserts a range of cells and shift cells according to the shift option.
Public methodInsertRange(CellArea, Int32, ShiftType, Boolean)
Inserts a range of cells and shift cells according to the shift option.
Public methodInsertRow
Inserts a new row into the worksheet.
Public methodInsertRows(Int32, Int32)
Inserts multiple rows into the worksheet.
Public methodInsertRows(Int32, Int32, InsertOptions)
Inserts multiple rows into the worksheet.
Public methodInsertRows(Int32, Int32, Boolean)
Inserts multiple rows into the worksheet.
Public methodIsBlankColumn
Checks whether given column is blank(does not contain any data).
Public methodIsColumnHidden
Checks whether a column at given index is hidden.
Public methodIsDeletingRangeEnabled
Check whether the range could be deleted.
Public methodIsRowHidden
Checks whether a row at given index is hidden.
Public methodLinkToXmlMap
Link to a xml map.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodMerge(Int32, Int32, Int32, Int32)
Merges a specified range of cells into a single cell.
Public methodMerge(Int32, Int32, Int32, Int32, Boolean)
Merges a specified range of cells into a single cell.
Public methodMerge(Int32, Int32, Int32, Int32, Boolean, Boolean)
Merges a specified range of cells into a single cell.
Public methodMoveRange
Moves the range.
Public methodRemoveDuplicates(Int32, Int32, Int32, Int32)
Removes duplicate values in the range.
Public methodRemoveDuplicates(Int32, Int32, Int32, Int32, Boolean, Int32)
Removes duplicate data of the range.
Public methodRemoveFormulas
Removes all formula and replaces with the value of the formula.
Public methodRetrieveSubtotalSetting
Retrieves subtotals setting of the range.
Public methodSetColumnWidth
Sets the width of the specified column in normal view.
Public methodSetColumnWidthInch
Sets column width in unit of inches in normal view.
Public methodSetColumnWidthPixel
Sets column width in unit of pixels in normal view.
Public methodSetRowHeight
Sets the height of the specified row.
Public methodSetRowHeightInch
Sets row height in unit of inches.
Public methodSetRowHeightPixel
Sets row height in unit of pixels.
Public methodSetViewColumnWidthPixel
Sets the width of the column in different view.
Public methodShowGroupDetail
Uncollapses the grouped rows/columns.
Public methodSubtotal(CellArea, Int32, ConsolidationFunction, Int32)
Creates subtotals for the range.
Public methodSubtotal(CellArea, Int32, ConsolidationFunction, Int32, Boolean, Boolean, Boolean)
Creates subtotals for the range.
Public methodTextToColumns
Splits the text in the column to columns.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUngroupColumns
Ungroups columns.
Public methodUngroupRows(Int32, Int32)
Ungroups rows.
Public methodUngroupRows(Int32, Int32, Boolean)
Ungroups rows.
Public methodUnhideColumn
Unhides a column
Public methodUnhideColumns
Unhide multiple columns.
Public methodUnhideRow
Unhides a row.
Public methodUnhideRows
Unhides the hidden rows.
Public methodUnMerge
Unmerges a specified range of merged cells.
Examples
[C#]

Workbook excel = new Workbook();
   Cells cells = excel.Worksheets[0].Cells;

   //Set default row height
   cells.StandardHeight = 20;
   //Set row height
   cells.SetRowHeight(2, 20.5);

   //Set default colum width
   cells.StandardWidth = 15;
   //Set column width
   cells.SetColumnWidth(3, 12.57);

   //Merge cells
   cells.Merge(5, 4, 2, 2);

   //Import data
   DataTable dt = new DataTable("Products");
dt.Columns.Add("Product_ID",typeof(Int32));
dt.Columns.Add("Product_Name",typeof(string));
dt.Columns.Add("Units_In_Stock",typeof(Int32));
DataRow dr = dt.NewRow();
dr[0] = 1;
dr[1] = "Aniseed Syrup";
dr[2] = 15;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = 2;
dr[1] = "Boston Crab Meat";
dr[2] = 123;
dt.Rows.Add(dr);
cells.ImportDataTable(dt, true, 12, 12, 10, 10);

//Export data
DataTable outDataTable = cells.ExportDataTable(12, 12, 10, 10);

[Visual Basic]

Dim excel as Workbook = new Workbook()
   Dim cells as Cells = excel.Worksheets(0).Cells

   'Set default row height
   cells.StandardHeight = 20
   'Set row height
   cells.SetRowHeight(2, 20.5)

   'Set default colum width
   cells.StandardWidth = 15
   'Set column width
   cells.SetColumnWidth(3, 12.57)

   'Merge cells
   cells.Merge(5, 4, 2, 2)

   'Import data
   Dim dt as DataTable = new DataTable("Employee")
   dt.Columns.Add("Employee_ID",typeof(Int32))
dt.Columns.Add("Employee_Name",typeof(string))
dt.Columns.Add("Gender",typeof(string))
Dim dr as DataRow = dt.NewRow()
dr(0) = 1
dr(1) = "John Smith"
dr(2) = "Male"
dt.Rows.Add(dr)
dr = dt.NewRow()
dr(0) = 2
dr(1) = "Mary Miller"
dr(2) = "Female"
dt.Rows.Add(dr)
cells.ImportDataTable(dt, true, 12, 12, 10, 10)

'Export data
Dim outDataTable as DataTable = cells.ExportDataTable(12, 12, 10, 10)
See Also