-
-
Notifications
You must be signed in to change notification settings - Fork 32
Fix missing bottom and right borders in table cells (Issue #160) #162
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
base: develop
Are you sure you want to change the base?
Conversation
This fix addresses the bug where table cell bottom and right borders were not rendering when using borderOptions configuration. Root Causes Fixed: 1. buildTableCellBorders() was using the wrong variable reference after destructuring, causing border properties to be lost 2. buildTableCell() was only applying table-level borders to edge cells, leaving middle cells without borders Changes: - Fixed buildTableCellBorders() to use destructured 'borders' variable instead of original 'tableCellBorder' object (lines 1766, 1769) - Modified buildTableCell() to apply table-level borders to ALL cells, not just edge cells (lines 2572-2594) - Added comprehensive test suite with 11 tests covering various border scenarios (tests/table-cell-borders.test.js) All 341 tests pass, including 11 new regression tests for this issue. Fixes #160 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
TurboDocx DOCX Diff Report
Summary
|
Added dedicated test that uses the exact code example from the issue reporter (dt-eric-lefevreardant) to verify both bottom and right borders are now correctly rendered. This test explicitly verifies the XML output matches what was expected in the original bug report. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Eric Lefevre-Ardant <134555809+dt-eric-lefevreardant@users.noreply.github.com>
K-Kumar-01
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking the existing functionality. Needs changes.
Fixes regression where tables with border-style: hidden or none were incorrectly showing borders after the fix for issue #160. Root Cause: The fix for #160 applied table-level borders to all cells unconditionally, which broke tables that explicitly set border-style: hidden or none. Changes: - Add conditional checks before applying table borders to cells - Only apply borders if border-style is not 'hidden' or 'none' - Preserves the #160 fix for borderOptions while respecting CSS border-style - Add regression tests for border-style: hidden and table-level border colors Testing: - All 343 tests pass including new regression tests - Verified border-style: hidden suppresses borders correctly - Verified table-level colored borders are respected - Original #160 fix remains intact (all cells get borders when appropriate) Test cases added: 1. Table with border-style: hidden (Kushal's first example) 2. Table with table-level colored borders (Kushal's second example) Reported-by: K-Kumar-01 <https://github.com/K-Kumar-01> Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add 7 new unit tests ported from manual examples in example-node.js, covering edge cases and complex border scenarios: Tests added: 1. Basic table without borders or styles 2. border-style: none with border attribute (conflicting directives) 3. Normal table with border attribute 4. border-width: 0px with border-style: solid 5. Complex border styles with multiple colors 6. Table with border attribute and border-collapse 7. Table with rowspan and colspan All 350 tests pass. These tests provide better coverage of real-world table border scenarios found in the manual test suite.



Summary
Fixes #160 - Missing bottom and right borders in table cells when using
borderOptionsconfiguration.Problem
When converting HTML tables to DOCX with
borderOptionsspecified, bottom and right borders were missing from table cells. Only top and left borders were being rendered.Root Causes
buildTableCellBorders()function bug: The function was using the wrong variable reference after destructuring, causing border properties to be lost during iteration.buildTableCell()edge-only border application: Table-level borders were only being applied to edge cells (first/last row/column), leaving middle cells without any borders.Solution
Changes Made
Fixed
buildTableCellBorders()(lines 1766, 1769):bordersvariable instead of originaltableCellBorderobjectbuildTableBorders()Fixed
buildTableCell()(lines 2572-2594):borderOptionsis specifiedTest Coverage
Added comprehensive test suite with 11 tests in
tests/table-cell-borders.test.js:Testing
Before Fix
After Fix
Development Approach
This fix was implemented using Test-Driven Development (TDD):
Example
Before Fix:
After Fix:
Checklist