SAXException: [word/header4.xml line 2]: Opening and ending tag mismatch: p line 0 and sdtContent

Hi, I got this error message and now most of my document is gone.

It’s an odt file that i’ve been saving as a .docx. According to properties details, all the data is still there, it just won’t show in libreoffice or word.

Is there a quick fix for this? Here’s the file if you need to poke around to find out.

If I ignore the error, the document opens. Only you can tell if some bit is missing.

I don’t know what you want to do with it. There are some aspects which contribute to instability.

  • all your paragraphs are Default Paragraph Style with direct formatting added

    Though direct formatting is mandatory in Word for intra-paragraph “decorations”, you should assign different paragraph styles based on Text Body (not on Default Paragraph Style) to your paragraphs as Word knows of paragraph styles. The thumb rule is “One paragraph significance, one style”.

    I can’t evaluate the formatting in your original .odt since you provided a DOCX, but if this is your working document, use character styles for word highlighting.

  • don’t use a text box in your header

    Its sole purpose is to add a transparent colour from edge to edge. You can do this (trickily I admit) with a combination of 0-left and 0-right margins in the page style plus a no-border padding distance to replace the margins. The header can be set to extend from margin to margin for background purpose, with Header paragraph style indents adjusted to simulate the previous margins.

  • don’t vertically space with empty paragraphs

    This contributes to grow the file size without real usefulness. Instead, use the properties of paragraph styles (which are associated with text significance) to include vertical spacing among them. Thus, it will automatically be added.

Generally speaking, work in .odt format, using all the styling features in Writer, which will really help you in tuning formatting and layout. Convert only before sending the finalised document, and only if recipient really can’t read ODF (which Word claims it can).