I find some difficulty to fulfill my requirement in application. I use EpPlus
library in my application with c#
.
I just need to find a text from excel sheet and its corresponding row number.
IN my excel sheet I have a text "Total",
I want to find which row that text contains and need to get that row number. Is it possible and not able to find in epplus
documentation.
Thanks & Regards Anil
Use can use LINQ query to get your result
int rowStart = worksheet.Dimension.Start.Row;
int rowEnd = worksheet.Dimension.End.Row;
string cellRange = rowStart.ToString() + ":" + rowEnd.ToString();
var searchCell =from cell in worksheet.Cells[cellRange] //you can define your own range of cells for lookup
where cell.Value.ToString() == "Total"
select cell.Start.Row;
int rowNum = searchCell.First();
You can get the cell address in which your string is.
foreach (var worksheetCell in worksheet.Cells)
{
if (worksheetCell.Value.ToString() == "Total")
{
var worksheetCellFullAddress = worksheetCell.Address;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.