Created attachment 190065 [details] tdf135061_DOC_mso2010.pdf: how tdf135061.odt -> DOC looks in MS Word The native way of handling objects anchored in a table cell is to naturally treat the cell as an anchor, and that also works for MS Word 2013+ DOCX (aka compat15). However, for older versions of MS Word, if layoutInCell is disabled, any flies anchored anywhere in the table are offset from the main table frame instead. (see bug 133552 for the import bug related to this.). At the moment, it looks OK in LO, but MS Word shows that the export is actually not OK. Since 7.4, LibreOffice properly exports the layoutInCell property to DOC format. However, that broke the ODT->DOC conversion, since native ODT doesn't need to specify GetFollowTextFlow(), and therefore we now export layoutInCell=false (which results in the changed layout in MS Word). Prior to 7.4, layoutInCell was not exported, and DOC import treats the absence of the flag to default layoutInCell to true, so things "automatically" worked. Perhaps then the easiest thing to do is to check if there is an ADD_FLY_OFFSET compat flag, and only then export the layoutInCell property. * DOCX: shouldn't matter since we export as compat15 - which forces layoutInCell * RTF: seems we don't export or import layoutincell. Steps to reproduce: 1.) Open tdf135061.odt from sw/qa/extras/uiwriter/data 2.) save in DOC format. 3a.) reload in MS Word - all shapes are crammed to the left side / smaller table 3b.) reload in LibreOffice - the table is much smaller Bisected to commit 98ecef56d0f87cd922ca560fead4e2533b30d57c Author: Justin Luth on Mon Feb 7 20:41:19 2022 +0200 tdf#79186 ww8export: save LayoutInCell property
This could get very messy, because LO seems to have a much more strict idea of what "Follow text flow" means than MS Word for shapes at least. And things change when opening the settings dialog and then pressing OK with "Follow text flow" enabled. Just for clarity, FollowTextFlow(LO) and layoutInCell(MSO) are essentially equivalent. tdf79186_noLayoutInCell.odt shows that at least textboxes need to be an exception.
(In reply to Justin L from comment #1) > tdf79186_noLayoutInCell.odt shows that at least textboxes need to be an > exception. see https://gerrit.libreoffice.org/c/core/+/102258 Patch that I am NOT going to propose, but just for illustration is at https://gerrit.libreoffice.org/c/core/+/157662
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/c63cce999629ef1aedfa688d1ef8753e13020c36 tdf#157637 ODT->DOC: use layoutInCell for para-oriented fly It will be available in 25.2.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.