Consider the following macro: sub Main my_cell = ThisComponent.Sheets(0).getCellByPosition(0,0) my_cell.String = "aa bb" + chr(10) + "cc dd" end sub It will write to A1 cell on the first sheet: aa bb cc dd It will be saved to ODS as: <table:table-cell office:value-type="string" calcext:value-type="string"> <text:p>aa bb</text:p> <text:p>cc dd</text:p> </table:table-cell> It is good. However, let's have "aa bb cc dd" in cell A1. Now we want to replace consecutive spaces to line breaks. We cannot do this from UI, so let's use a macro. sub Main rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args2(17) as new com.sun.star.beans.PropertyValue args2(0).Name = "SearchItem.StyleFamily" args2(0).Value = 2 args2(1).Name = "SearchItem.CellType" args2(1).Value = 0 args2(2).Name = "SearchItem.RowDirection" args2(2).Value = true args2(3).Name = "SearchItem.AllTables" args2(3).Value = false args2(4).Name = "SearchItem.Backward" args2(4).Value = false args2(5).Name = "SearchItem.Pattern" args2(5).Value = false args2(6).Name = "SearchItem.Content" args2(6).Value = false args2(7).Name = "SearchItem.AsianOptions" args2(7).Value = false args2(8).Name = "SearchItem.AlgorithmType" args2(8).Value = 1 args2(9).Name = "SearchItem.SearchFlags" args2(9).Value = 65536 args2(10).Name = "SearchItem.SearchString" args2(10).Value = " {2,}" args2(11).Name = "SearchItem.ReplaceString" args2(11).Value = chr(10) args2(12).Name = "SearchItem.Locale" args2(12).Value = 255 args2(13).Name = "SearchItem.ChangedChars" args2(13).Value = 2 args2(14).Name = "SearchItem.DeletedChars" args2(14).Value = 2 args2(15).Name = "SearchItem.InsertedChars" args2(15).Value = 2 args2(16).Name = "SearchItem.TransliterateFlags" args2(16).Value = 1280 args2(17).Name = "SearchItem.Command" args2(17).Value = 3 dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args2()) end sub Please note, that the replacement text is the same chr(10) as in the first macro. But in A1 we will see: "aa bbcc dd". When we save it to ODS, we have this xml in the file: <table:table-cell office:value-type="string" calcext:value-type="string"> <text:p>aa bb <text:line-break/> cc dd</text:p> </table:table-cell> So, we don't have two <text:p> elements, but the <text:line-break/> between the two lines. Unfortunately when LibreOffice reads this back, the line break disappears forever. Interestingly saving to XLS and reload from that XLS preserves the line break. Expected behaviour: if chr(10) means line break in the cell, then it should work in case of search and replace, too.
Hello Andras, is it duplicate of bug 75702?
Created attachment 114018 [details] test case
(In reply to raal from comment #1) > Hello Andras, > is it duplicate of bug 75702? It is not duplicate, but related.
(In reply to Andras Timar from comment #3) > (In reply to raal from comment #1) > > Hello Andras, > > is it duplicate of bug 75702? > > It is not duplicate, but related. The root of the problem is in reading of <text:line-break/>, isn't it? When I run your second macro, I see line break, but after save and reopen is line break missing.
(In reply to raal from comment #4) I don't see the line break when I run the second macro. Moreover, I expect that first and second macro insert the same type of line break. It is incorrect that chr(10) is a paragraph break one time, and soft line break (which is not imported) the other time.
chr(10) should be the same probably, setting to new.
** Please read this message in its entirety before responding ** To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present on a currently supported version of LibreOffice (5.0.5 or 5.1.2 https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System Please DO NOT - Update the version field - Reply via email (please reply directly on the bug tracker) - Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to "inherited from OOo"; 4b. If the bug was not present in 3.3 - add "regression" to keyword Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa Thank you for your help! -- The LibreOffice QA Team This NEW Message was generated on: 2016-04-16
** Please read this message in its entirety before responding ** To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present on a currently supported version of LibreOffice (5.2.7 or 5.3.3 https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to "inherited from OOo"; 4b. If the bug was not present in 3.3 - add "regression" to keyword Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug-20170522
*** Bug 114398 has been marked as a duplicate of this bug. ***
As per bug #114398 (closed as dup of this one), this issue is present, and can manifest not only in macros but also (and IMO more dangeoursly) in copy-paste to cell when text in the clipboard is available in Rich Text format. See that bug for steps to reproduce it in Calc 5.4.3.2
FORMER: https://opengrok.libreoffice.org/xref/core/sc/source/ui/unoobj/cellsuno.cxx?r=0eaa0804#6022 either of https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/docfunc.cxx?r=185e01c0#1165 https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/docfunc.cxx?r=185e01c0#1175 https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/docfunc.cxx?r=185e01c0#1181 https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/docfunc.cxx?r=185e01c0#962 https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/docfunc.cxx?r=185e01c0#966 https://opengrok.libreoffice.org/xref/core/sc/source/core/data/document.cxx?r=ec7ba61a#3372 https://opengrok.libreoffice.org/xref/core/sc/source/core/data/document.cxx?r=ec7ba61a#3421 https://docs.libreoffice.org/sc/html/classScEditEngineDefaulter.html https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/editutil.cxx?r=8da8cc3c#547 https://opengrok.libreoffice.org/xref/core/editeng/source/editeng/editeng.cxx?r=8feca893#1466 https://opengrok.libreoffice.org/xref/core/editeng/source/editeng/impedit2.cxx?r=8feca893#651 https://opengrok.libreoffice.org/xref/core/editeng/source/editeng/impedit2.cxx?r=8feca893#662 https://opengrok.libreoffice.org/xref/core/editeng/source/editeng/impedit2.cxx?r=8feca893#2726 https://opengrok.libreoffice.org/xref/core/editeng/source/editeng/impedit2.cxx?r=8feca893#2742 LATTER: https://opengrok.libreoffice.org/xref/core/xmloff/source/text/txtparae.cxx?r=f87fab63#3580
Dear Andras Timar, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
Bug detailed in my comment #10 (2017-12-19 14:48:09 UTC) still present. Steps for reproduce in linked issue https://bugs.documentfoundation.org/show_bug.cgi?id=114398 Version: 7.1.2.2 (x64) / LibreOffice Community Build ID: 8a45595d069ef5570103caea1b71cc9d82b2aae4 CPU threads: 6; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win Locale: es-AR (es_AR); UI: en-US Calc: CL
If I execute the macro: Sub Main my_cell = ThisComponent.Sheets(0).getCellByPosition(0,0) my_cell.String = "aa bb" + chr(10) + "cc dd" End Sub Then I end up in [1] where simpy the AdjustRowHeight is missing. Imho, bug 114398 is not a duplicate of this one, since it ends in [2] where no string or edit cell is set. [1] https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/docfunc.cxx?r=a23a7eea&mo=40925&fi=1270#1270 [2] https://opengrok.libreoffice.org/xref/core/sc/source/ui/view/viewfunc.cxx?r=ec1c4c49&mo=19813&fi=566#566
For not creating an EditCell when reading an embedded <text:line-break/> this is a duplicate of bug 75702 that was fixed. For not creating (I'm *assuming* this is the case) an EditCell with multiple paragraphs for such replacement result with an embedded linefeed this is similar to bug 120190 but not a duplicate as another code path is involved. Keeping for that.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/56ae7d01505fdae421109cfc78449230ba589d79 tdf#89920 - Handle embedded newline in Calc's search cell It will be available in 7.6.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.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/8fc316fb65e0d4b78ec881aa79f4184602b96f54 tdf#89920 - Handle embedded newline in Calc's search cell It will be available in 7.6.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.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "libreoffice-7-5": https://git.libreoffice.org/core/commit/002ff93e2319385716571adec633bbf97930158e tdf#89920 - Handle embedded newline in Calc's search cell It will be available in 7.5.3. 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.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "libreoffice-7-5": https://git.libreoffice.org/core/commit/f2fb7d930b10626d9987b0ed52cc8e6a281c0f0d tdf#89920 - Handle embedded newline in Calc's search cell It will be available in 7.5.3. 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.
Sadly, the above commit does NOT fix the problem I reported in https://bugs.documentfoundation.org/show_bug.cgi?id=114398 (closed as dup of this one). Tested with Dev build LibreOfficeDev_7.5.3.0.0_Win_x86-64.msi (2023-Apr-09 06:48) https://git.libreoffice.org/core/+log/8914765ec9330d250e220b1ef51f7c62b82b8e2f which includes I copy the steps to Reproduce: 1. Open a new Calc Spreadsheet . Enlarge the first cell, say to half the window width and height. 2. Open Windows Wordpad (or some editor that copies in RichTextFormat) Type several lines separated not by hard end-of-paragraph newlines (Enter) but instead by soft line-breaks (Shift+Enter) 3. Select those lines, copy to clipboard (Ctrl-C) 4. In Calc, focus in the big cell in edit mode (F2), and paste from the clipboard (Ctrl-V) 5. All should look basically ok (also if we switch to another cell, sheet, document, etc). Close Calc, saving the file. 6. Open the saved document. Result: all soft newlines are gone. They are not even replaced by spaces, the original lines are joined together (a mess).
Created attachment 186567 [details] Screencast of the basic steps I could not reproduce the error in: Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 1ed50bb714b8ed657cd422df850a6852cd863f43 CPU threads: 16; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win Locale: de-DE (de_DE); UI: en-US Calc: CL threaded
Andreas: I tested with the dev version of 7.5.3 (nightly build), as hinted. I understand that this is the version that will be released this month, and which is supposed to solve this issue (an the closed as dup). I don't see any release plans for version 7.6.0 . Anyway, if there is some way of downloading that build 7.6.0.0.alpha0+, please tell me and i'll try to test it.
Hm, I cannot repro do issue in: Version: 7.5.2.2 (X86_64) / LibreOffice Community Build ID: 53bb9681a964705cf672590721dbc85eb4d0c3a2 CPU threads: 16; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win Locale: de-DE (de_DE); UI: de-DE Calc: CL threaded Are you on antoher OS?
Using Windows 10 and 11 Here's a video https://www.youtube.com/watch?v=Q9tCbmlgKBA
Sorry, here it goes again. https://www.youtube.com/watch?v=MIgLmpuKnoM