public void Export() { FileInfo newFile = new FileInfo(filename); if (newFile.Exists) { newFile.Delete(); // ensures we create a new workbook newFile = new FileInfo(filename); } using (package = new ExcelPackage(newFile)) { TimelineSheet timeline; TeamStatsSheet teamStats; GameUnitsStatsSheet gu; ProjectStats stats = new ProjectStats(project); ws = CreateSheet(package, Catalog.GetString("Project statistics")); var statsSheet = new ProjectStatsSheet(ws, project); statsSheet.Fill(stats); ws = CreateSheet(package, project.LocalTeamTemplate.TeamName + "(" + Catalog.GetString("Local Team") + ")"); teamStats = new TeamStatsSheet(ws, stats, Team.LOCAL); teamStats.Fill(); ws = CreateSheet(package, project.VisitorTeamTemplate.TeamName + "(" + Catalog.GetString("Visitor Team") + ")"); teamStats = new TeamStatsSheet(ws, stats, Team.VISITOR); teamStats.Fill(); ws = CreateSheet(package, Catalog.GetString("Timeline")); timeline = new TimelineSheet(ws, project); timeline.Fill(); ws = CreateSheet(package, Catalog.GetString("Game units")); gu = new GameUnitsStatsSheet(ws, stats); gu.Fill(); package.Save(); } }