Bug 159871 - Pasting formulas to text editor by View Formulas (Ctrl+`) mode skips sheet address
Summary: Pasting formulas to text editor by View Formulas (Ctrl+`) mode skips sheet ad...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
24.2.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Cell-Formula Cut-Copy
  Show dependency treegraph
 
Reported: 2024-02-24 20:00 UTC by Piotr Osada
Modified: 2024-02-28 12:55 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
tdf#159871 between-sheet-formula.ods (19.19 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-02-24 20:09 UTC, Piotr Osada
Details
tdf#159871 between-sheet-formula pasting (Ctrl+`).png (49.87 KB, image/png)
2024-02-24 20:10 UTC, Piotr Osada
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Osada 2024-02-24 20:00:14 UTC
Description:
LibreOffice loses the sheet address when pasting into a text editor.

Version: 24.2.0.3 (X86_64) / LibreOffice Community
Build ID: da48488a73ddd66ea24cf16bbc4f7b9c08e9bea1
CPU threads: 4; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: pl-PL (pl_PL); UI: en-US
Calc: threaded

Steps to Reproduce:
1) Create Sheet2
2) Link cell A1 from Shee1 in Sheet2 (also A1)
3) View -> Show Formula (Ctrl+`)
4) Copy A1 from Sheet2 (text of formula: "=$Sheet1.A1")
5) Paste into text editor
6) Pasting result: "=$''.A1"

Actual Results:
=$''.A1

Expected Results:
=$Sheet1.A1


Reproducible: Always


User Profile Reset: No

Additional Info:
.
Comment 1 Piotr Osada 2024-02-24 20:09:47 UTC
Created attachment 192749 [details]
tdf#159871 between-sheet-formula.ods
Comment 2 Piotr Osada 2024-02-24 20:10:20 UTC
Created attachment 192750 [details]
tdf#159871 between-sheet-formula pasting (Ctrl+`).png
Comment 3 m_a_riosv 2024-02-24 20:13:52 UTC
Reproducible with
Version: 24.2.1.0.0+ (X86_64) / LibreOffice Community
Build ID: cafcc50570f9edaaebe74d2152bae5df1cc2edfe
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded
Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: c68712d3689a0322e59934cd8151d003e869f30d
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded

Works better than in 7.6, where only copy the value.
https://bugs.documentfoundation.org/show_bug.cgi?id=159338
Comment 4 ady 2024-02-27 14:48:08 UTC
In addition to the worksheet name in a formula, an item to also check is whether the path to another workbook is correctly pasted when copy-pasting formulas directly from the cell when Show Formulas is ON.
Comment 5 Heiko Tietze 2024-02-28 08:04:05 UTC
The formula =$Sheet2.A1 is actually =$#REF!.A1 so references are still valid when you rename Sheet2. It's not an implementation error but needs to be considered on copy. 

Meanwhile you can copy from the edit mode.
Comment 6 ady 2024-02-28 10:51:50 UTC
(In reply to Heiko Tietze from comment #5)
> The formula =$Sheet2.A1 is actually =$#REF!.A1 so references are still valid
> when you rename Sheet2. It's not an implementation error but needs to be
> considered on copy. 

I'm confused. What STR are you using in order to get #REF? Who said anything about renaming any worksheet?

> 
> Meanwhile you can copy from the edit mode.

For 1 single cell, we can copy the formula from the input box of the formula bar. The point here is to be able to copy the content of multiple cells.
Comment 7 Heiko Tietze 2024-02-28 11:19:36 UTC
(In reply to ady from comment #6)
> I'm confused. What STR are you using in order to get #REF?
Paste as unformatted text or paste into a text editor, some input line... the actual content is a variable.
Comment 8 ady 2024-02-28 11:52:39 UTC
(In reply to Heiko Tietze from comment #7)
> (In reply to ady from comment #6)
> > I'm confused. What STR are you using in order to get #REF?
> Paste as unformatted text or paste into a text editor, some input line...
> the actual content is a variable.

But that is not the original STR of this report. You are not supposed to copy the input line of some variable content. While showing formulas, you are supposed to copy the cell (which contains a formula pointing to a different worksheet), directly, no edit mode, no input box.
Comment 9 Piotr Osada 2024-02-28 12:32:58 UTC
(In reply to ady from comment #8)
> But that is not the original STR of this report.

Yes, this report is about missing sheet names in formulas copied in 'View Formulas' mode and pasted for example into Notepad.exe, Notepad++ etc.


(In reply to Heiko Tietze from comment #5)
> The formula =$Sheet2.A1 is actually =$#REF!.A1 so references are still valid
> when you rename Sheet2.

Checking your consideration, I have noticed that after renaming the sheet, the formula works properly, but the text of this formula remains unchanged (as it was when the formula was created).

So this is not an issue connected with ticket number 159871. Is this necessary to make another bug report about following sheet names in formulas?
Comment 10 Piotr Osada 2024-02-28 12:36:08 UTC
(In reply to Piotr Osada from comment #9)
> after renaming the sheet (...) the text of this formula remains unchanged

In addition, even after saving as, and reopening the file, the formula still contains the inappropriate old sheet name.
Comment 11 ady 2024-02-28 12:55:15 UTC
(In reply to Piotr Osada from comment #10)
> (In reply to Piotr Osada from comment #9)
> > after renaming the sheet (...) the text of this formula remains unchanged
> 
> In addition, even after saving as, and reopening the file, the formula still
> contains the inappropriate old sheet name.

This report is simple to reproduce. Worksheet renaming has nothing to do with this report (and I am not reproducing such behavior either).

Moreover, the problem reported in this tdf#159871 can be replicated in LO 7.6 and older versions too; just use menu Tools > Options > LibreOffice Calc > View > Formulas, instead of using menu View > Show Formulas.

Let's please keep the conversation on topic.