Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docx writer: documents with tables fail to validate #9266

Closed
jgm opened this issue Dec 18, 2023 · 5 comments
Closed

docx writer: documents with tables fail to validate #9266

jgm opened this issue Dec 18, 2023 · 5 comments
Labels

Comments

@jgm
Copy link
Owner

jgm commented Dec 18, 2023

Golden test validation failures with docx-validate
@edwintorok

table_one_row.docx

./tmp/document-pretty.xml:9: element jc: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}jc': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblCaption, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblDescription, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblPrChange ).

tables-default-widths.docx

./tmp/document-pretty.xml:18: element jc: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}jc': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblCaption, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblDescription, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblPrChange ).
./tmp/document-pretty.xml:236: element jc: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}jc': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblCaption, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblDescription, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblPrChange ).
./tmp/document-pretty.xml:301: element jc: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}jc': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblCaption, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblDescription, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblPrChange ).

tables.docx

./tmp/document-pretty.xml:18: element jc: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}jc': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblCaption, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblDescription, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblPrChange ).
./tmp/document-pretty.xml:237: element jc: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}jc': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblCaption, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblDescription, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblPrChange ).
./tmp/document-pretty.xml:303: element jc: Schemas validity error : Element '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}jc': This element is not expected. Expected is one of ( {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblCaption, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblDescription, {http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblPrChange ).
@jgm jgm added the bug label Dec 18, 2023
@jgm
Copy link
Owner Author

jgm commented Dec 18, 2023

@jgm
Copy link
Owner Author

jgm commented Dec 18, 2023

We have

      <w:tblPr>
        <w:tblStyle w:val="Table" />
        <w:tblW w:type="pct" w:w="5000" />
        <w:tblLook w:firstRow="0" w:lastRow="0" w:firstColumn="0" w:lastColumn="0" w:noHBand="0" w:noVBand="0" w:val="0000" />
        <w:jc w:val="start" />
        <w:tblLayout w:type="fixed" />
      </w:tblPr>

@jgm
Copy link
Owner Author

jgm commented Dec 18, 2023

Order should be:
tblStyle
tblW
jc
tblLook

@edwintorok
Copy link
Contributor

Thanks for fixing these so quickly, I'll try to send a few more small fixups today, I think we're quite close to getting all of test/docx/golden to pass validation.

And once we reach that place, then I'll think of a way to add a CI test to keep it that way (I think it is possible to cache CI output keyed on certain files, so it should be possible to restrict triggering this CI step only when the golden files actually change).

@jgm
Copy link
Owner Author

jgm commented Dec 18, 2023

I added a target to the Makefile make validate-docx-golden-tests.
Currently they all validate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants