GemBox Support Forum

XLSX file can't be read by Microsoft OpenXML

We have implemented an interface using GemBox Spreadsheet Version
The interface saves the data to an XLSX file, using the following code:


On the other end of the interface our client gets the following error (in German):


The current workaround is to open the XLSX file in Microsoft Excel, saving it as an XLS file and then saving it as an XLSX file again.

Should we be using a different way to save the XLSX file?

Hi MKruck,

I’m afraid I was unable to reproduce this.
I tried using the latest version of GemBox.Spreadsheet and OpenXML SDK:

static void Main()
    var path = "example.xlsx";

    // Write Excel file with GemBox.Spreadsheet.
    var workbook = new ExcelFile();
    var worksheet = workbook.Worksheets.Add("Sheet1");

    for (int r = 0; r < 50; r++)
        for (int c = 0; c < 10; c++)
            worksheet.Cells[r, c].Value = c + r * 10;


    // Read Excel file with OpenXML SDK.
    using var spreadsheet = SpreadsheetDocument.Open(path, false);
    var rows = spreadsheet.WorkbookPart.WorksheetParts.First()

    foreach (var row in rows)
        foreach (var cell in row.Elements<Cell>())
            Console.Write($"{cell.CellValue.Text,3}  ");

Just in case, can you try again with the latest versions?

If the problem remains, please send us a small Visual Studio project that reproduces your issue so that we can investigate it.