当前位置:编程学习 > C#/ASP.NET >>

C# 设置Excel中某个单元格中的某一个文字的样式

Microsoft.Office.Interop.Excel.Range timeRange = worksheet.get_Range(
        worksheet.Cells[2, 1], worksheet.Cells[2, 16]);                                      //选取单元格
        timeRange.Merge(true);                                                               //合并单元格
        timeRange.RowHeight = 24;                                                            //设置行高
        timeRange.HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter;   //水平居中
        timeRange.VerticalAlignment = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter;     //垂直居中
        timeRange.Font.Name = "宋体";   //设置字体
        timeRange.Font.Size = 12;  //字体大小
        timeRange.Font.Underline = Microsoft.Office.Interop.Excel.XlUnderlineStyle.xlUnderlineStyleSingle;//设置下划线
        timeRange.Value2 = "2009-2010学年第  一   学期";


我想将“2009”、“2010”和“一” 分别加上下划线,有没有高手知道代码该怎么写啊? --------------------编程问答-------------------- 已经找到答案了!
timeRange.get_Characters(1, 4).Font.Underline
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,