Repaired Records : Cell information from worksheet created from scratch

前端 未结 7 1492
醉话见心
醉话见心 2021-01-31 08:58

I\'m receiving an error when opening my OpenXML created spreadsheet. The error is as follows.

Repaired Records: Cell information from /xl/worksheets/sheet.xml p         


        
7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-31 09:16

    Stumbled on this issue myself and found this thread. Difference in my case could not repair the file. Issue was row index which I passed to InsertCellInWorksheet taken from example on MSDN.

    Cell cell = InsertCellInWorksheet("A", lastRow.RowIndex, worksheetPart);
    

    When inserting a row, make sure the index of the row is 1, not 0. However, 0 for the SheetData collection.

    sheetData.InsertAt(new Row() { RowIndex = 1 }, 0);
    lastRow = sheetData.Elements().LastOrDefault();
    

    In hope to save someone time who goes through the same trouble.

    Interestingly enough, my integration test passed, however, when opening the file via Excel, it was showing the pop-up about corruption. Seems there is a row with index 0, however, bit secretive as you will not be able to open a file with Excel.

提交回复
热议问题