C# 使用c从Excel工作表导入富文本数据
我想使用richtext(即字体系列)从excel工作表导入数据 但我只能使用下面给定的代码获得粗体和斜体样式C# 使用c从Excel工作表导入富文本数据,c#,excel,c#-4.0,office-interop,C#,Excel,C# 4.0,Office Interop,我想使用richtext(即字体系列)从excel工作表导入数据 但我只能使用下面给定的代码获得粗体和斜体样式 Microsoft.Office.Interop.Excel.Range Range = (Microsoft.Office.Interop.Excel.Range)Cell; int TextLength = Range.Text.ToString().Length; for (int CharCount = 1; CharCount <= TextLength
Microsoft.Office.Interop.Excel.Range Range = (Microsoft.Office.Interop.Excel.Range)Cell;
int TextLength = Range.Text.ToString().Length;
for (int CharCount = 1; CharCount <= TextLength; CharCount++)
{
Microsoft.Office.Interop.Excel.Characters charToTest = Range.get_Characters(CharCount, 1);
bool IsBold = (bool)charToTest.Font.Bold;
bool IsItalic = (bool)charToTest.Font.Italic;
// other formatting tests here
}
有谁能帮助我使用Interop或c.net中的任何其他方法从Excel工作表中获取富文本数据
提前感谢怎么样:
Range someRange = activeWorksheet.Range["A1", "A1"];
var fontFamily = someRange.Font.Name;