What is invalid about this docx?

Matthew Binsfeld 21 Reputation points
2023-03-21T18:42:10.34+00:00

Hi,

I generated this docx with my software. The Open XML SDK productivity tool does show some validation errors, but fixing these errors doesn't make it so this docx can be opened in Word. Usually when I have an invalid docx word gives me the option to repair and open, but this one appears to be too broken to even do that.

NOTE: I added .txt to the end of the file, so that the forum would let me upload the docx.

out.docx.txt

Office
Office
A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.
1,712 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,989 questions
Office Open Specifications
Office Open Specifications
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Open Specifications: Technical documents for protocols, computer languages, standards support, and data portability. The goal with Open Specifications is to help developers open new opportunities to interoperate with Windows, SQL, Office, and SharePoint.
139 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mike Bowen 1,781 Reputation points Microsoft Employee
    2023-03-22T21:14:08.3233333+00:00

    Hi @Matthew Binsfeld ,

    I looked through the docx and besides the errors that the validator finds, there is invalid markup in header1.xml and header4.xml. If you look both of those files contain empty <w:sdtContent /> elements, but this is invalid. sdtContent must have at least one inline-level structure, such as a w:p.

    From ISO/IEC 29500 17.5.2.34 sdtContent (Block-Level Structured Document Tag Content)

    "This element specifies the last known contents of a structured document tag around one or more block-level structures (paragraphs, tables, etc.)"

    If you replace the self-closing <w:sdtContent /> with something simple like below and resolve the errors found by the validator, the file will open without needing repair.

    <w:sdtContent>
      <w:p>
        <w:r>
          <w:t></w:t>
        </w:r>
      </w:p>
    </w:sdtContent>
    

    Please give that a try and let me know if you can open the file. If it resolves your issue, please mark this as answered.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.