Welcome to OpenXML Developer Sign in | Join | Help

How to validate the .xlsx that I generate?

Last post 12-03-2008, 4:06 PM by gibble. 5 replies.
Sort Posts: Previous Next
  •  09-18-2008, 6:35 AM 3707

    How to validate the .xlsx that I generate?

    The compile is successful and I can download the spreadsheet that I generate.

    but when the document which I generate is being open.

    it tells me the file is corrupted, but I don't know how and where.

    Is there anyway to validate my document including relationship checking and make debugging easier?

  •  09-18-2008, 7:45 AM 3710 in reply to 3707

    Re: How to validate the .xlsx that I generate?

    Have you tried the built-in Validation-methods in the SDK?

    How to: Validate the Contents of a Document Part in an Office Open XML Package by Using the Open XML API
    http://msdn.microsoft.com/en-us/library/bb521234.aspx

    How to: Validate an Office Open XML Package against a Collection of Schemas by Using the Open XML API
    http://msdn.microsoft.com/en-us/library/cc547024.aspx

    How to: Validate an Office Open XML Package by Using the Open XML API
    http://msdn.microsoft.com/en-us/library/bb497334.aspx

    I am not sure it does relation-ship validation, though.

    /Jesper
  •  09-18-2008, 7:54 AM 3711 in reply to 3707

    Re: How to validate the .xlsx that I generate?

    Btw,

    I just read up in the Help-files from the SDK and for the method

    OpenXmlPackage.Validate()

    the text is:

    Validates the package. However, it does not validate the XML content in each part.

    I would think that it would indeed validate the relations - the question is, though, if it only validates the package relationships or if it also validates e.g. inline relationships from SpreadsheetML-cells to their corresponding sharedStrings-Part.
  •  09-18-2008, 10:48 PM 3713 in reply to 3711

    Re: How to validate the .xlsx that I generate?

    I think the Validate() is doing the later one which you mention.

    I have a PageSetup that reference to a not exsisting .xml and it still passes the Validate() method.

    This method is useless to me.

  •  11-12-2008, 5:35 AM 3864 in reply to 3713

    Re: How to validate the .xlsx that I generate?

    it would be nice to have 1 validate method that can validate the entire package, i'm having an issue with a SpreadsheetDocument that passes validate but throws an error when you open it in Excel.

    ** plus i think it's a nice double check to run in unit tests for export code

  •  12-03-2008, 4:06 PM 3921 in reply to 3864

    Re: How to validate the .xlsx that I generate?

    Anyone have a good way to validate the doc before we save a corrupt file?
View as RSS news feed in XML