Simple excel creation does not open file is corrupt
Clash Royale CLAN TAG #URR8PPP Simple excel creation does not open file is corrupt I am trying to create a simple excel file with multiple sheets using open xml, unfortunately the file does not open after it's being created. After the file is generated, when I open it with Microsoft Excel it says We found a problem, do you want to recover as much as we can? using (SpreadsheetDocument spreedDoc = SpreadsheetDocument.Create(filePath, DocumentFormat.OpenXml.SpreadsheetDocumentType.Workbook)) { WorkbookPart wbPart = spreedDoc.WorkbookPart; wbPart = spreedDoc.AddWorkbookPart(); wbPart.Workbook = new Workbook(); Sheets sheets = wbPart.Workbook.AppendChild(new Sheets()); foreach (var sheetData in excelSheetData) { // Add a blank WorksheetPart. WorksheetPart worksheetPart = wbPart.AddNewPart<WorksheetPart>(); worksheetPart.Worksheet = new Worksheet(new SheetData()); string relationshipId = wbPart.GetIdOfPart(worksheetPart); ...