Bug 75702 - FILEOPEN: line-break ignored (The cell should display one line above the other - comment 18)
Summary: FILEOPEN: line-break ignored (The cell should display one line above the othe...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1 all versions
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: BSA target:7.5.0 inReleaseNotes:7.5
Keywords:
Depends on:
Blocks: Calc-Cells
  Show dependency treegraph
 
Reported: 2014-03-03 10:44 UTC by sylvain
Modified: 2022-12-07 16:40 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
A1 cell with two lines (1.92 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-03-03 10:44 UTC, sylvain
Details
Sample file with line break added. (9.31 KB, application/xml)
2014-03-03 23:12 UTC, m_a_riosv
Details
Cell with a line-break in Writer (8.33 KB, application/vnd.oasis.opendocument.text)
2014-03-04 08:37 UTC, sylvain
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sylvain 2014-03-03 10:44:04 UTC
Created attachment 95016 [details]
A1 cell with two lines

Problem description: 
<text:line-break/> are ignored in cells.

Steps to reproduce:
1. Generate a file with a line break or open the attached file

Current behavior:
All line breaks are removed, leaving only one line of text. On save the new lines are gone from the file.

Expected behavior:
The cell should display one line above the other.

Operating System: Windows 7
Version: 4.2.1.1 release
Comment 1 sylvain 2014-03-03 10:51:16 UTC
The file opens and saves fine in OpenOffice 3.2.
In LibreOffice 3.6.2.1 the single line is hidden. I.e. If the file content was line1<line-break/>line2 then the cell content is line1line2\n but only the second empty line is displayed unless the row height is grown.
Comment 2 m_a_riosv 2014-03-03 23:12:12 UTC
Created attachment 95063 [details]
Sample file with line break added.

Hi sylvain, thanks for reporting.

Your file open without line break in 4.1.6 4.2.1 4.2.2

But adding a line break, save, open in any of this version with line break.
find attached the new file.
Comment 3 sylvain 2014-03-04 08:33:03 UTC
Hi,
  sorry if I wasn't clear, the bug is ignoring the XML element <text:line-break/>. Not the UI feature of line break which in Calc insert a new <text:p>.
But this could be connected as in Writer inserting a line break in in the UI creates an actual <text:line-break/> element.
Comment 4 sylvain 2014-03-04 08:36:02 UTC
Sorry hit save before finishing my last sentence ;
But this could be connected as in Writer inserting a line break in a table cell from the UI creates an actual <text:line-break/> element. I've attached a sample.
Comment 5 sylvain 2014-03-04 08:37:10 UTC
Created attachment 95074 [details]
Cell with a line-break in Writer
Comment 6 m_a_riosv 2014-03-04 22:32:41 UTC
I have not found if it might be available in ods files as part of cell text.
Comment 7 sylvain 2014-03-17 10:15:20 UTC
The XML syntax is the same for all document types, see 9.1.1 in OpenDocument-v1.2-os-part1 and also 6.1.1 Paragraph Elements Content/Basic Text Content/General : "The paragraph elements <text:p> and <text:h> and their *descendant elements* contain the text content of *any* document." IMHO this clearly says that <text:line-break/> (just as <text:s/> and <text:span>) should be supported everywhere by LibreOffice and not just in Writer. All the more since multi-line UI is already supported in Calc.
Comment 8 retired 2015-01-04 12:01:51 UTC
OSX behaves identical thus OS > All.

Not sure if this should or should not be working. Setting to Enhancement and NEW.

We need a dev to chime in on this if this enhancement request makes sense or not.
Comment 9 Priyanka Gaikwad 2015-05-29 05:14:32 UTC
Line breaks are working with version Version: 5.1.0.0.alpha1+
Comment 10 m_a_riosv 2015-08-23 22:37:16 UTC
Please @sylvain, is the issue solved?
Comment 11 m_a_riosv 2015-12-27 02:17:42 UTC
Four month without info.
Resolved.
Please if you have the issue, reopen it again.
Comment 12 Stefan Rijnhart 2017-12-29 14:10:43 UTC
<table:table-cell office:value-type="string" calcext:value-type="string"><text:p>line1<text:line-break/>Line2</text:p></table:table-cell> still renders as a single line in LibreOffice 5.1.6.2.
Comment 13 Xisco Faulí 2018-01-17 17:35:59 UTC
(In reply to Stefan Rijnhart from comment #12)
> <table:table-cell office:value-type="string"
> calcext:value-type="string"><text:p>line1<text:line-break/>Line2</text:p></
> table:table-cell> still renders as a single line in LibreOffice 5.1.6.2.

Could you please try in LibreOffice 5.4.4.2 ?
Comment 14 Kenneth Hanson 2018-04-11 03:13:46 UTC
Bug is still present in 6.0.3.2

I entered two lines in a cell with Ctrl-Enter, then manually replaced ...</text:p><text:p>... with <text:line-break/>. The line break disappeared.
Comment 15 Jorge Maroto 2018-10-30 16:40:28 UTC
Note that using `setDataArray` API call will insert `<text:line-break>` instead of `<text:p>`, so those inserted new lines will be removed as soon as the document is saved and re-opened.
Comment 16 Justin L 2022-09-19 15:06:14 UTC
This should be fixed in master (7.5) with https://gerrit.libreoffice.org/c/core/+/140110

At least, when editing the cell the newline is there.
Comment 17 Commit Notification 2022-09-19 19:11:29 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/60585bb65330ad703b5683aece1564dfc6301436

tdf#75702 sc: unit test for preserving text:line-break

It will be available in 7.5.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.
Comment 18 Justin L 2022-09-20 15:09:22 UTC
What is fixed is the loss of text:line-break. What still remains is OP's expectation that "The cell should display one line above the other."

Currently A1 still looks like "line1line2".  With the fix in LO 7.5, the F2 editing bar now properly shows "line1
line2".

It is almost impossible to actually create this new-line situation now. Editing always makes a real paragraph instead of only a line break.

The remaining situation is perfectly described in bug 104902. We just need a similar editeng fix on file open.
Comment 19 Justin L 2022-09-20 15:23:46 UTC
another similar situation is bug 142033 and bug 142033 comment 5 is describing this bug report.
Comment 20 Commit Notification 2022-09-21 17:28:35 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8f5f0c754222425af019a9fdc1ba47d72c541d9e

tdf#75702 ODS import: send text:line-break to editeng

It will be available in 7.5.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.
Comment 21 Stéphane Guillou (stragu) 2022-12-05 16:23:17 UTC
Verified as fixed in:

Version: 7.5.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 6d6a2343b1d45695f3ea02818d317a022a7b259f
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Thanks Justin!