Skip to content

GetRowValue.cs

Avrigeanu Laurian edited this page Apr 12, 2023 · 1 revision

GetRowValue(object sheet, int index)

Parameters

  • sheet : Object representing the worksheet where the data is located.
  • index : Integer representing the index of the row to be retrieved.

Returns

  • Returns a list of objects containing the values of the specified row.

Remarks

  • This method retrieves the values of the specified row in the worksheet as a list of objects. The row is identified by its index number, and the sheet parameter represents the worksheet where the data is located.
  • The returned list contains all the values of the row as objects, including empty cells. If a cell is empty, it will be represented in the list as null.
  • The method uses the Value2 property to retrieve the cell values. This property returns a 2D array of objects representing the cell values of the specified range.

GetRowValueModern(object sheet, int index)

Parameters

  • sheet : Object representing the worksheet where the data is located.
  • index : Integer representing the index of the row to be retrieved.

Returns

  • Returns a list of objects containing the values of the specified row.

Remarks

  • This method retrieves the values of the specified row in the worksheet as a list of objects. The row is identified by its index number, and the sheet parameter represents the worksheet where the data is located.
  • The returned list contains all the values of the row as objects, including empty cells. If a cell is empty, it will be represented in the list as null.
  • The method uses the Value2 property to retrieve the cell values. This property returns a 2D array of objects representing the cell values of the specified range.
  • This method uses a more modern and efficient approach to retrieve the values. It retrieves the row object only once and stores it in a variable for better performance.
  • It also explicitly releases the COM object reference to the row object using Marshal.ReleaseComObject() method to prevent memory leaks.
Clone this wiki locally