Code to mimic LibreOffice's ability to have a table "keep with next" was introduced in Jun 2007. On 19-Nov-2008 it was broken by this major reworking: CWS-TOOLING: integrate CWS hb11 http://cgit.freedesktop.org/libreoffice/core/commit/?id=f4e5153daa7859cc5a5aec44ee578bf81195ca93 The code is still all there, but is just deactivated by an abandoned variable (bOutTable in wrtw8nds.cxx). Replacing this with IsInTable() may be appropriate.
A proposed fix was pushed to https://gerrit.libreoffice.org/#/c/16123. It re-enables "keep with next" emulation, and produces similar layout between ODT and DOC (except in certain instances where .doc follows MS Word layout instead).
see bug 34957 for a suite of testcases.
There is a path conflict and the patch cannot be merged. Please rebase.
The only time the variable (now m_bOutTable) is currently set to true is in WW8AttributeOutput::OutputFlyFrame_Impl. Emulating "keep with next" for fly frame tables doesn't seem valid since flies currently cannot span pages anyway, so the rows will always be kept together on the same page. Additionally, a Fly Frame can't have a following paragraph "kept" to it, right? The meaning of m_bOutTable appears to have changed considerably since it was first introduced. 2008's commit f4e5153daa7859cc5a5aec44ee578bf81195ca93 shows the removal of instances when it set to true under totally different circumstances (and no NEW instances of setting it were added at that time). Using IsInTable() [introduced in May 2011 with commit ea45be76b6475d2a400db56535fd0d9baf117713] does give the desired results. Previous versions of LO can also open these documents without any stability problems. The purpose of this fix is to have a .doc file emulate what the original .odt looks like. It is an export setting. It doesn't affect importing MSWord originating files, since MSWord doesn't have this setting anyway. I'll be breaking down my earlier patch into smaller chunks, and resubmitting for the 5.2 branch in a couple of weeks.
Justin Luth committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=4ec0cc0781312d908a46dca382fae8e416753756 tdf#91083 - .doc: emulate table kept-with-next not splitting It will be available in 5.2.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=0d127baed75929e744d5b6249f510012cfbc0e88 tdf#91083 - .doc: emulate table keep-with-next paragraph It will be available in 5.2.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
*** Bug 98396 has been marked as a duplicate of this bug. ***
*** Bug 97229 has been marked as a duplicate of this bug. ***
Justin Luth committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=129f93e46c29b388d38e9097869fd3e72dc40a5e tdf#91083 ww8import: set table keep/split properties if emulated It will be available in 5.3.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
(In reply to Commit Notification from comment #9) > http://cgit.freedesktop.org/libreoffice/core/commit/ > ?id=129f93e46c29b388d38e9097869fd3e72dc40a5e > > tdf#91083 ww8import: set table keep/split properties if emulated This part is being reverted because it caused a bad regression (bug 104333). proposed reversion: https://gerrit.libreoffice.org/31551
bug 132642 is a regression, so the patch was tweaked in 7.0 a bit to ensure that it only affected MS Formats, as well as not trying so hard to not split.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/fb0628b5ffe2571af3fb811c5c5109698b1bf773 tdf#91083 sw layout: don't emulate table keep when already set It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.