Skip to content

fix: keep the text of tables nested in DOCX table cells - #13906

Closed
astroknot-sheep wants to merge 1 commit into
deepset-ai:mainfrom
astroknot-sheep:fix/docx-nested-table-cells
Closed

astroknot-sheep wants to merge 1 commit into
deepset-ai:mainfrom
astroknot-sheep:fix/docx-nested-table-cells

Conversation

@astroknot-sheep

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes:

DOCXToDocument._cell_text only read cell.paragraphs, so a table nested inside a table cell was dropped without any warning. It now walks the cell's children in order: paragraphs are handled as before (including link_format), and a nested table is read cell by cell, one nested cell per line. The existing CSV quoting and markdown line-break escaping then take care of the multi-line cell, so the outer table shape does not change.

How did you test it?

Added test_run_reads_a_table_nested_in_a_table_cell for both CSV and markdown formats. It fails on main and passes with this change. Ran the full test_docx_file_to_document.py locally (53 passed), and pre-commit on the changed files.

Notes for the reviewer

I iterate tr.tc_lst instead of row.cells for the nested table so a horizontally merged nested cell is not repeated.

I used an AI assistant while finding and fixing this; I have reviewed the change and the test myself.

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

@astroknot-sheep
astroknot-sheep requested a review from a team as a code owner November 25, 2026 03:31
@astroknot-sheep
astroknot-sheep requested review from davidsbatista and removed request for a team November 25, 2026 03:31
@vercel

vercel Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Someone is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Dhriman Deka seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added topic:tests type:documentation Improvements on the docs labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/components/converters
  docx.py
Project Total  

This report was generated by python-coverage-comment-action

@davidsbatista

Copy link
Copy Markdown
Contributor

Hi @astroknot-sheep, we're closing this PR because the Contributor License Agreement (CLA) check is still pending after 48 hours. Thanks a lot for your interest in contributing to Haystack!

The commit is authored as [email protected], which isn't linked to your GitHub account, so CLA Assistant can't match it to the CLA you already signed. To fix it, either add that email to your GitHub account (Settings → Emails), or amend the commit with your GitHub noreply email and force-push. Then use the "recheck" link in the CLA comment and reopen this PR. It will then automatically be marked ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOCXToDocument drops the text of a table nested inside a table cell

3 participants