none
Spreadsheet created by OpenXml SDK 2.5 failing validation without any details RRS feed

  • Question

  • I am trying to create a spreadsheet using Open XML SDK 2.5, and although the file can be opened in MS Excel, it gives a prompt-

    "We found a problem with some content in "filename.xlsx". Do you want us to recover as much as we can?"

    If i click yes, it opens the excel just fine, with a message-

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

    I tried to validate the generated fine in Open XML SDK Productivity tool, where it gives following error description for almost all the cells-

    "Element 'DocumentFormat.OpenXML.Spreadsheet.CellFormat' referenced by 'c@s' does not exist in part '/WorkbookPart/WorkbookStylesPart'. The index is '1'."

    What am I missing? I have not added any style information or stylepart in the spreadsheet, yet this probably is related to style information. Is adding a stylepart mandatory?

    Friday, July 11, 2014 11:50 AM

Answers

All replies

  • HI Julien

    It's really not possible for us to say exactly what the problem is based on the information provided.

    My recommendation would be to use the Open XML SDK Productivity Tool to

    1. Compare the generated and the repaired documents, so that you can see EXACTLY what Excel changes

    AND/OR

    2. Look at the code the tool proposes for creating the repaired document and compare it to the code you've written


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, July 11, 2014 3:45 PM
    Moderator
  • This is the difference found in the Productivity tool comparer after the recovery. Left side is the old one and right side is the recovered one-
    Monday, July 14, 2014 2:21 PM
  • It appears that Excel recreated the worksheet, so there must be something wrong with how you're creating the sheet. I recommend you look at the code the Tool suggests for creating sheet1.xml for the recovered workbook and compare it to the code you're using.

    Cindy Meister, VSTO/Word MVP, my blog

    Monday, July 14, 2014 4:03 PM
    Moderator