C# Snippets


hideGridLines

public static void hideGridLines(Excel.Application excelApp, Excel.Worksheet worksheet)
{
try
{
if (excelApp == null || excelApp.ActiveWindow == null || worksheet == null)
return;

excelApp.ActiveWindow.DisplayGridlines = false;

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


setOrientation

private static void setOrientation(Excel.Worksheet sheet, Constants.OrientationStyle orientationStyle = Constants.OrientationStyle.NONE)
{
try
{
switch (orientationStyle)
{
case Constants.OrientationStyle.LANDSCAPE:
sheet.PageSetup.Orientation = Excel.XlPageOrientation.xlLandscape;
break;

case Constants.OrientationStyle.PORTRAIT:
sheet.PageSetup.Orientation = Excel.XlPageOrientation.xlPortrait;
break;
}
}
catch (System.Exception ex)
{
ExceptionHandling.MessageShow(System.Reflection.MethodBase.GetCurrentMethod(), ex);
}
}


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