clipboard, gnumeric format: problem with absolute addresses.
Submitted by an unknown user
Link to original bug (#360849)
Description
Enter the following data:
A1: 1
A2: 2
A3: =$A1+
A$2 3 is displayed
Select A1:A3 and copy to clipboard.
Start another gnumeric process. Place cursor in B1 and paste. 0 is displayed in B3, and the cell contains =$A1+
A$2, exactly as in the source.
This behaviour is the same for pasting between two different gnumerics over the X or Windows clipboard, and between two workbooks in the same gnumeric process.
You asked for it, you got it, but this makes no sense. The formula has nothing to do with A1 and A2 in the destination sheet.
There are three interpretations that would make sense.
a) Refer to A1 and A2 in the source sheet/workbook. Sometimes, this would be
what the user intended, but probably not most of the time. There are too many
problems to make this the default: What do we do with sources which haven't
been written to disk? Moving either the source or the destination workbook
would break stuff, etc.
b) Transform absolute references to cells inside the source range to absolute
references to cells in the destination. In this case: =$B1+
B$2
c) Replace absolute references outside the source range with their values. So B3
would become =1+2 or 3.
b) may be closest to what the user expects, but c) would also be better than what we are doing now.
This is closely related to the issue in 360666: dependencies not taken into account when exporting via clippboard.
OpenCalc is no better than Gnumeric in this respect. $A$1 in the source becomes $A$1 in the dest.
You see one consequence of this in charts. When you build them by marking data and using the wizard, data series have absolute addresses. So if you mark a chart and all the data it is based on, and paste it into another gnumeric, the copy of the chart will look nothing like the original. Unless you happen to paste it into the same cell in the destination.
One final twist: When copying charts, there is a difference between copying between two gnumerics and between two workbooks in the same gnumeric. Between gnumerics, the data series 'Sheet1!$A1:
A$3' is copied unchanged. Between workbooks in the same gnumeric, a reference to the source workbook is added:
'[../../../home/jk/gnome/chart.gnumeric]Sheet1!$A1:
A$3'. I.e. solution a) above. This is fragile!
Version: git master