C# Snippets


setBackgroundColor

public static void setBackgroundColor(Excel.Worksheet worksheet, string startCell, string endCell)
{
try
{
if (worksheet == null)
return;

//worksheet.get_Range("A1").EntireRow.EntireColumn.Interior.Color = System.Drawing.Color.Gray;
worksheet.get_Range("A1").EntireRow.EntireColumn.Interior.Color =
System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(50, 50, 50));

Excel.Range coverRange = worksheet.get_Range(startCell, endCell);

//coverRange.Interior.Color = System.Drawing.Color.White;
coverRange.Interior.Color =
System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(255, 255, 255));

}
catch (System.Exception ex)
{
ExceptionHandling.MessageShow(System.Reflection.MethodBase.GetCurrentMethod(), ex);
}
}


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top