如何在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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2863 次 |
| 最近记录: |