Description: Export xlsx/xls with "Automatically wrap text" turned off for cells containing line breaks with Ctrl+Enter, and when you open it again, the wrapping setting is turned on. Steps to Reproduce: 1.enter any text 2.Press Ctrl+Enter to break a line in the middle of text 3.Right click on that cell -> Format Cells -> Alignment tab 4.Make sure "Wrap text automatically" of Properties, is turned off 5.Export to xlsx or xls file 6.Open xlsx/xls file 7.Check "Wrap text automatically" setting Actual Results: "Wrap text automatically" setting is turned on Expected Results: "Wrap text automatically" setting is turned off Reproducible: Always User Profile Reset: No Additional Info: Version: 7.6.2.1 (X86_64) / LibreOffice Community Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333 CPU threads: 4; OS: Linux 5.10; UI render: default; VCL: gtk3 Locale: ja-JP (ja_JP.UTF-8); UI: en-US Calc: threaded I checked and reported based on the information in the Ask below: https://ask.libreoffice.org/t/topic/98573
Issue has been reproduced.
I reproduced it Version: 7.6.3.2 (X86_64) / LibreOffice Community Build ID: 29d686fea9f6705b262d369fede658f824154cc0 CPU threads: 12; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win Locale: ja-JP (ja_JP); UI: ja-JP Calc: CL threaded
Also repro with Latin fonts, so it is not related to CTL nor specific to Japanese fonts. Saving as ods is fine.
There are several similar reports about exporting or saving the "wrap text automatically" cell attribute to either xlsx or to xls, but please note: * a cell containing multiple lines ([CTRL]+[ENTER]), with wrap text ON, exports correctly; * a cell containing multiple lines ([CTRL]+[ENTER]), with wrap text OFF, exports with wrap text ON. IOW, a cell containing multiple lines (with each line introduced with [CTRL]+[ENTER] within the same cell) is _always_ exported with wrap text ON > BUG. Also note that the way the text is displayed within the cell is not necessarily an indication of the status (ON/OFF) of the "wrap text automatically" attribute. You have to either check the cell properties or the status of the related icon on the toolbar.
Created attachment 191147 [details] Excel: a cell with a line break with wrap disabled I *suspect* that this is required in Excel: from a quick test, disabling wrap in a cell there merges the lines into a single line. Code reading is necessary, but most likely this it NOTABUG / NOTOURBUG (because it's an external application limitation).
There is difference of key code with calc and Excel for meaning break Line. In calc, that is Ctrl+Ent. But in excel, that is Alt+Ent. Is this difference concered with this issue?
(In reply to watanabe nobuo from comment #6) > There is difference of key code with calc and Excel for meaning break Line. > Is this difference concered with this issue? No.
(In reply to Mike Kaganski from comment #5) > I *suspect* that this is required in Excel: from a quick test, disabling > wrap in a cell there merges the lines into a single line. Calc 24.2 imports similarly with https://gerrit.libreoffice.org/c/core/+/156206 And in your example - if the user does any editing then Excel increases the row height. (In reply to Shinji Enoki from comment #0) > Export xlsx/xls with "Automatically wrap text" turned off for cells > containing line breaks with Ctrl+Enter, and when you open it again, the > wrapping setting is turned on. True ever since the first LO 3.3.0 (when save as XLSX was introduced). I assume this was "fixed" for XLSX in 24.2 with https://gerrit.libreoffice.org/c/core/+/155970, but I am in the process of reverting that (since with that patch cells formatted with "wrap text" were exported as without wrap enabled).
Created attachment 196854 [details] wrap-text.xlsx: Paris' unit test - the first three instances are not wrap-text
(In reply to Justin L from comment #8) > Calc 24.2 imports XLSX similarly with and XLS imports a round-tripped wrap-text.xls as a single line in 7.6.x from commit b224e450d09a0405043a011d48f4f57e88cdc344 Author: Henry Castro on Tue Feb 28 09:50:28 2023 -0400 sc: filter: excel: import cell multi-line text The excel document, if the cell has multi-line text and the property wrap text is off, the paragraphs are rendered all in a single line.
Created attachment 196868 [details] 158460_multiline.ods: unresolvable puzzle for XLSX Whoever thinks they can fix this bug needs to wrestle with the implications of 158460_multiline.ods. When a user interacts with LO (creating new content for example) then they can see in their newly modified XLSX document what is seen in this ODS file. The fact that Excel simply cannot have both newlines and out-flowing text is proof to me that "the way Excel does things" is broken, and the fact that we started to copy this broken behaviour on import in 24.2 is just wrong. Thus, the most correct way to handle this is the way we have already been doing it - to export any multiline content as wrap-enabled (since LO will never create multiline content on only one line). The ONLY time when we can export multiline without wrap-text is if we know we are DISPLAYING it in only one line.
proposed export fix (for the new case where we copy Excel's buggy behaviour and import newlined content as if it was a single line) at https://gerrit.libreoffice.org/c/core/+/174436
*** Bug 97106 has been marked as a duplicate of this bug. ***
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/424329bb0b71fdb46b56be5638d5304dbef9e718 tdf#158460 xls/x export: don't force wrap-text for imported single-line 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.
Based on mk's comment 5 (confirmed in comment 11), I will mark this as NOTOURBUG. (I'm not marking as fixed, since comment 14 resolves a new 7.6-ish situation while other situations pre-date 7.6.) It is an XLS/XLSX format limitation. We should be round-tripping OK at this point.