Hello
How do I see if some text within a cell is struck through?
Thanks,
Richard
Hi Richard,
Thank you for using Aspose products.
You can use Style.Font.IsStrikeout property to detect if text in a cell has Strikethrough effect. Sample code is provided below,
C#
var book = new Workbook(myDir + “Book1.xlsx”);
var sheet = book.Worksheets[0];
var cell = sheet.Cells[“A1”];
var style = cell.GetStyle();
if (style.Font.IsStrikeout)
{
Console.WriteLine(cell.Name + " is Strikeout");
}
Hi,
And, please see the sample code below on how to check if some specific characters in the cell are strikeout or not. I used the simple template file (attached).
e.g
Sample code:
Workbook workbook = new Workbook(“e:\test2\chartests.xlsx”);
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
Cell aCell = worksheet.Cells[“A1”];
//Check if the specific chars (bcd) in the A1 cell are strike out or not
MessageBox.Show(aCell.Characters(1, 3).Font.IsStrikeout.ToString());
Let me know if I can be of any further help.
Thank you.
Perfect, thank you very much!
Hi,
Good to know that your issue is figured out now. Feel free to contact us anytime if you need further help or have some other queries or issue, we will be happy to assist you soon.
Thank you.