Simple debugging of Office XML files

Those previous two posts were meant to help people unfamiliar with Office XML get a taste of how you would go about building your own spreadsheets. The power of doing this with XML is that you can read and generate these files anywhere you want. You don’t need Office on the machines you are using to work with the files. This is especially important when dealing with large numbers of documents or as part of a web service, as the Office applications are not supported running in an unattended mode on a server. XML lets you do it in a supported, and very efficient way.

As you start to experiment with XML in the Office applications, you will no doubt create XML files that can’t be opened. By default there aren’t great error messages reported, because we don’t want to confuse the average end user. If the file can’t be opened, then it can’t be opened, there isn’t much that the average user can do to fix it. If you are a developer or solution builder though and you actually generated that file, then it would be nice to get some more information on the problem. There are a number of options you have to make debugging your files easier. Here are the steps you should take when you have trouble opening a file:

  1. Check the Error Message: Look at the error message. In Excel for instance, there will be a log file generated that has the information on the error. In Word, there is an advanced mode for the error dialog that gives you more information on what happened. In Word, you should pretty print your files first as the error message reports the column and line number of the problem (and a error saying Line 1 Column 2043 isn’t too helpful) 
  2. Check for Well Formed XML: One common problem if you weren’t using an XML editor to generate your file is that your files might not be well formed XML. To check for well formedness, you can just open the file in IE. If the XML isn’t well formed, IE will tell you so and notify you where the problem is.
  3. Make sure it’s Valid: Your files need should be valid according to our schemas. The schemas are freely available to download here: You can take an XML parser that supports schema validation such as MSXML and validate your file against the schema.


Comments (11)

  1. skits says:

    If you are a developer, I would recommend a much better option. Open the document in the XML Editor (VS 2005). The error list will tell you what’s wrong with the file. There are a lot more great features in the new XML Editor. To see some of them, read this article ( by Neetu Rajpal – Lead PM on the XML Tools team or view a video presentation by Ken Levy (

    Stan Kitsis

  2. BrianJones says:

    Great suggestion Stan, thanks.

    VS 2005 makes it a lot easier to work against the schemas and debug any well formedness errors. This in combination with the error messages returned by the Office applications should have you in pretty good shape.


  3. Francesca says:

    Hi Brian;

    I’m sorry for using this space not to write a comment to your post but I would like to ask you something about XML file.

    I try to explain you my problem: I have XML files that use different DTDs, so when I Load one of them how cuold I be sure that I’ reading right file? I though that I could compare DTD of the opening XML file and one Iexpected to read. To do this I use comparison between file content but it cuold be very long. Is there a method to make this comparision more quickly?

    Thank you for your attention and your kindness.


  4. Eric DeFazio says:

    Afternoon Brian,

    Just out of curiousity, could you tell me how the new Office Formats will effect Office Web Components?

    1)Is the file format for OWC going to change to correspond (more closely) with the new Office Formats (the low level XML)

    2) Will a new version of Office Web Components (OWC 12) be created to work with updated file formats?

    3) Given the new Office file formats rely on Zip containers, how will this be accomplished given OWC are embeddable as ActiveX controls within a Web Page?


    M. Eric DeFazio

  5. BrianJones says:

    Hi Eric,

    Right now, we aren’t really talking much about the rest of what’s to come in Office 12. PDC, which is in September will carry the next wave of announcements (as you can see from the lineup of sessions).

    We announced the file formats really early so we had enough time to educate folks on the implications as well as gather tons of feedback. The first beta isn’t for a few months still though, so you can expect to hear a lot more leading up to that.


  6. Abhinav says:

    Hi Brian

    Can you comment on how will the Office 12 SpreadsheetML support macros, pivot tables, and Excel charts? These were some of the features that Office 2002 Excel XML did not support.


  7. BrianJones says:


    Macros are only supported in the macro-enabled format, and they are stored the same as in Word and PPT (a seperate binary part within the ZIP package). Charts are also stored as their own seperate part in the package, but they are represented with XML. Pivot tables will also be represented in XML (I’ll try to post some examples).


  8. Rafael says:


    I’m a developper who is generating reports in excel programming with PHP. My problem is when I try to open one file excel I get one error message and indications about one error log created in some directory… but that directory and that file doesn’t exists.

    ¿Can anyone help me?

    Thanks a lot for your help.


  9. Rafael says:

    Hello again,

    Yesterday I forget to mention that I’m using Office 2003 Professional.

    Thanks a lot.


  10. Rafael says:

    I founded the location of the error logs… It was strong hidden.

    Thanks anyways.