【问题标题】:Excel : Add Border Top on Cell....Excel:在单元格上添加边框顶部......
【发布时间】:2016-02-26 05:21:34
【问题描述】:

我正在将我的radgridview 导出到excel。我的问题是如何在单元格上添加边框顶部...我对此很陌生,所以请多多包涵...

我已尝试使用此代码.Borders[Excel.XlBordersIndex.xlEdgeTop].Weight = 1d;,但仍然无法在 excel 单元格上执行bordertop.....

提前致谢。

        foreach (GridViewSummaryRowInfo item in gridviewID.MasterView.SummaryRows)
        {
            objexcelapp.Cells[lastRow + 3, 4] = item.Cells[item.Index + 4].Value.ToString();
            objexcelapp.Cells[lastRow + 3, 5] = item.Cells[item.Index + 5].Value.ToString();
            objexcelapp.Cells[lastRow + 3, 4].Font.Bold = true;
            objexcelapp.Cells[lastRow + 3, 5].Font.Bold = true;

        }

【问题讨论】:

    标签: c# excel winforms radgridview


    【解决方案1】:

    这个对我有用

    Excel.Range range = sheet.UsedRange;
    Excel.Range cell = range.Cells[1][1];
    Excel.Borders border = cell.Borders;
    border[XlBordersIndex.xlEdgeLeft].LineStyle =
       Excel.XlLineStyle.xlContinuous;
    border[XlBordersIndex.xlEdgeTop].LineStyle =
       Excel.XlLineStyle.xlContinuous;
    border[XlBordersIndex.xlEdgeBottom].LineStyle =
        Excel.XlLineStyle.xlContinuous;
    border[XlBordersIndex.xlEdgeRight].LineStyle =
        Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-10
      • 2014-06-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多