I'm parsing an Excel spreadsheet using Microsoft's Excel Interop. I was instructed to ignore any values that have been "stricken through" (see image).
The code I'm using to get the value is simple:
string cellValue = Convert.ToString(cell.Value);
Maybe I could check each character in the cellValue
to see if its ASCII code is beyond an acceptable range?
EDIT: With the help of the answer below, I was able to solve this by doing the following:
if (cellValue.Font.Strikethrough)
{
continue;
}
else
{
// process value
}
You should retrieve the Cell Format. I don't have excel here but I think it should be something like:
myworksheet.Cells[row, col].Font.Strikethrough;
See this question: Reading text format from Excel using Microsoft.Office.Interop.Excel
If that doesn't work, look at answer of Danny, he tells you should check if a character is StrikeTrough.
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.