使用C#在Excel表格中查找粗体文本

如何在Excel工作表的单元格中查找粗体文本? 我使用C#,OLEDB和ADO.NET读取xls文件,但我不解决如何解决我的任务。 我需要使用Iterop.Excel吗?

是的,你需要Interop.Excel

using Microsoft.Office.Interop.Excel; int FindFirstBold(Range cell) { for (int index = 1; index <= cell.Text.ToString().Length; index++) { Characters ch = cell.get_Characters(index, 1); bool bold = (bool) ch.Font.Bold; if(bold) return index; } return 0; }