private void AddSessionBestInfo(SessionSummary sessionSummary, ExcelWorksheet sheet) { ExcelRange range = sheet.Cells["K5:L9"]; range.Style.Border.BorderAround(ExcelBorderStyle.Medium, SessionBestColor.ToDrawingColor()); sheet.Cells["K5"].Value = "Session Best:"; sheet.Cells["K6"].Value = "Sector 1:"; sheet.Cells["K7"].Value = "Sector 2:"; sheet.Cells["K8"].Value = "Sector 3:"; sheet.Cells["K9"].Value = "Lap:"; if (sessionSummary.SessionBestSector1 != null) { sheet.Cells["L6"].Value = FormatSessionBest( sessionSummary.SessionBestSector1, sessionSummary.SessionBestSector1.Sector1); } if (sessionSummary.SessionBestSector2 != null) { sheet.Cells["L7"].Value = FormatSessionBest( sessionSummary.SessionBestSector2, sessionSummary.SessionBestSector2.Sector2); } if (sessionSummary.SessionBestSector3 != null) { sheet.Cells["L8"].Value = FormatSessionBest( sessionSummary.SessionBestSector3, sessionSummary.SessionBestSector3.Sector3); } if (sessionSummary.SessionBestLap != null) { sheet.Cells["L9"].Value = FormatSessionBest( sessionSummary.SessionBestLap, sessionSummary.SessionBestLap.LapTime); } sheet.Cells["K5:K9"].Style.Font.Bold = true; sheet.Cells["L5:L9"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right; range.AutoFitColumns(); }
private void AddDriverInfo(ExcelWorksheet sheet, ExcelRow row, Driver driver, SessionSummary sessionSummary) { sheet.Cells[row.Row + 1, 1].Value = GetFinishPositionInfo(driver, sessionSummary.SessionType == SessionType.Race); sheet.Cells[row.Row + 1, 2].Value = driver.DriverName; sheet.Cells[row.Row + 1, 3].Value = driver.CarName; sheet.Cells[row.Row + 1, 4].Value = driver.TotalLaps; sheet.Cells[row.Row + 1, 5].Value = driver.BestPersonalLap == null ? string.Empty : FormatTimeSpan(driver.BestPersonalLap.LapTime); sheet.Cells[row.Row + 1, 6].Value = driver.BestSector1Lap == null ? string.Empty : FormatTimeSpan(driver.BestSector1Lap.Sector1); sheet.Cells[row.Row + 1, 7].Value = driver.BestSector2Lap == null ? string.Empty : FormatTimeSpan(driver.BestSector2Lap.Sector2); sheet.Cells[row.Row + 1, 8].Value = driver.BestSector3Lap == null ? string.Empty : FormatTimeSpan(driver.BestSector3Lap.Sector3); sheet.Cells[row.Row + 1, 9].Value = driver.TopSpeed.GetValueInUnits(VelocityUnits).ToString("N0") + Velocity.GetUnitSymbol(VelocityUnits); if (driver.BestPersonalLap == sessionSummary.SessionBestLap) { sheet.Cells[row.Row + 1, 5].Style.Fill.PatternType = ExcelFillStyle.Solid; sheet.Cells[row.Row + 1, 5].Style.Fill.BackgroundColor.SetColor(SessionBestColor.ToDrawingColor()); sheet.Cells[row.Row + 1, 5].Style.Font.Color.SetColor(System.Drawing.Color.White); } if (driver.BestSector1Lap == sessionSummary.SessionBestSector1) { sheet.Cells[row.Row + 1, 6].Style.Fill.PatternType = ExcelFillStyle.Solid; sheet.Cells[row.Row + 1, 6].Style.Fill.BackgroundColor.SetColor(SessionBestColor.ToDrawingColor()); sheet.Cells[row.Row + 1, 6].Style.Font.Color.SetColor(System.Drawing.Color.White); } if (driver.BestSector2Lap == sessionSummary.SessionBestSector2) { sheet.Cells[row.Row + 1, 7].Style.Fill.PatternType = ExcelFillStyle.Solid; sheet.Cells[row.Row + 1, 7].Style.Fill.BackgroundColor.SetColor(SessionBestColor.ToDrawingColor()); sheet.Cells[row.Row + 1, 7].Style.Font.Color.SetColor(System.Drawing.Color.White); } if (driver.BestSector3Lap == sessionSummary.SessionBestSector3) { sheet.Cells[row.Row + 1, 8].Style.Fill.PatternType = ExcelFillStyle.Solid; sheet.Cells[row.Row + 1, 8].Style.Fill.BackgroundColor.SetColor(SessionBestColor.ToDrawingColor()); sheet.Cells[row.Row + 1, 8].Style.Font.Color.SetColor(System.Drawing.Color.White); } }