PHPWord icon indicating copy to clipboard operation
PHPWord copied to clipboard

Generate Table Cell if Row Doesn't Have Any

Open oleibman opened this issue 1 year ago • 3 comments

Description

Fix #2505. Word treats file as corrupt if a table row does not contain a cell (documentation for why this is so is included in the issue). Person reporting the issue suggests that dropping such a row from the output file is preferred. However, I think generating an empty cell instead is closer to the user's expectation. For example, as demonstrated in the unit tests added with this PR, if a table has row 1 and 3 which contain cells, but row 2 does not, the table as written to the file will have 3 rows, with the second containing an empty cell.

Checklist:

  • [x] I have run composer run-script check --timeout=0 and no errors were reported
  • [x] The new code is covered by unit tests (check build/coverage for coverage report)
  • [ ] I have updated the documentation to describe the changes

oleibman avatar Nov 30 '23 15:11 oleibman

Coverage Status

coverage: 97.209% (+0.001%) from 97.208% when pulling 054d0d019bea9523d9f4726125d3eb744425ec39 on oleibman:word2505b into 2daa50c6f34c9cb6c532f72350e4bd8d466d6c71 on PHPOffice:master.

coveralls avatar Nov 30 '23 15:11 coveralls

Hi @oleibman , tested locally and LGTM. Thank you.

lucasnetau avatar Nov 30 '23 23:11 lucasnetau

@Progi1984 Change log updated, all your suggestions except one are incorporated; that one needs further discussion,

oleibman avatar Jan 07 '24 18:01 oleibman