Les caractères gras et italiques ne fonctionnent pas dans Excel avec EPPLUS

Je suis en utilisant le code ci-dessous pour la mise à jour des données excel format, ici, je veux le titre en caractères gras et à l'ensemble de données en italique format mais quand je lance le code de toutes les fonctionnalités, il semble fonctionner correctement sauf pour le Gras et l'Italique. Code également l'exécution terminée sans erreur, mais dans le fichier excel aucun des cellules sont d'avoir les données en gras ou en italique format.

    public void FormatExcel()
{
string currentDate = DateTime.Now.ToString("yyyyMMdd");
FileInfo File = new FileInfo("G:\\Selenium\\Test66.xlsx");
using (ExcelPackage excel = new ExcelPackage(File))
{
ExcelWorksheet worksheet = excel.Workbook.Worksheets[currentDate];
int totalRows = worksheet.Dimension.End.Row;
int totalCols = worksheet.Dimension.End.Column;
var headerCells = worksheet.Cells[1, 1, 1, totalCols];
var headerFont = headerCells.Style.Font;
headerFont.Bold = true;
headerFont.Italic = true;
headerFont.SetFromFont(new Font("Times New Roman", 12));
headerFont.Color.SetColor(Color.DarkBlue);
var headerFill = headerCells.Style.Fill;
headerFill.PatternType = ExcelFillStyle.Solid;
headerFill.BackgroundColor.SetColor(Color.Gray);
var dataCells = worksheet.Cells[2, 1, totalRows, totalCols];
var dataFont = dataCells.Style.Font;
dataFont.Italic = true;
dataFont.SetFromFont(new Font("Times New Roman", 10));
dataFont.Color.SetColor(Color.DarkBlue);
var dataFill = dataCells.Style.Fill;
dataFill.PatternType = ExcelFillStyle.Solid;
dataFill.BackgroundColor.SetColor(Color.Silver);
var allCells = worksheet.Cells[1, 1, totalRows, totalCols];
allCells.AutoFitColumns();
allCells.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
var border = allCells.Style.Border;
border.Top.Style = border.Left.Style = border.Bottom.Style = border.Right.Style = ExcelBorderStyle.Thin;
excel.Save();
}
}

source d'informationauteur Ash1994