Change the background of Cells with C#

前端 未结 3 2147
走了就别回头了
走了就别回头了 2021-02-19 08:49

I\'m developing an program using C# to manipulate an Excel document, and I\'m using

    Microsoft.Office.Interop.Excel._Worksheet worksheet;

W

3条回答
  •  滥情空心
    2021-02-19 09:18

    Try

    worksheet.Cells[x, y].Interior.Color
    

    You won't be able to use the Colors in .Net directly, they will require a translation.

    It is recommended to use the following (obviously change from silver) :

    worksheet.Cells[x, y].Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Silver);
    

提交回复
热议问题