Reputation: 23
I want to find the cell in an Excel sheet that contains a certain text using closedXML. I use the following command:
IXLCells RefCells =PortfolioWorksheet.Search(strInternalReference, CompareOptions.None, false);
Accoridng to the Watch window in Visual Studio, RefCells does contain the correct cell address: C8 in my case.
I tried obtaining this value with:
RefCells.First().GetValue<string>()
Unfortunately I get the string I searched for and not the cell address.
Hope you can help!
Bas
Upvotes: 0
Views: 1432
Reputation: 17560
GetValue()
returns the content (value) of the cell. To get the address use Address.ToString()
to get the full address or Address.RowNumber
and Address.ColumnLetter
(or Address.ColumnNumber
) to get its parts.
Upvotes: 2