Bug 76523 - Copy of sheet (to New File) does not copy named items
Summary: Copy of sheet (to New File) does not copy named items
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:5.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-23 17:50 UTC by Torge Riedel
Modified: 2017-12-26 10:58 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Document for reproducing (13.50 KB, application/vnd.ms-excel)
2014-03-23 17:50 UTC, Torge Riedel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Torge Riedel 2014-03-23 17:50:24 UTC
Created attachment 96250 [details]
Document for reproducing

Problem description: 

Steps to reproduce:
1. Open the attached file "Export_Standard.xls"
2. You, that there are named items like "ExportTitle" and "ExportName"
3. Duplicate the sheet

Current behavior:
The new sheet does not have the named items. If you open this file in MS Excel and copy the sheet, the named items are duplicated too.

I think the reason ist, that in the original Excel file the named items are local in the sheet, but treated global in LibreOffice. That's why they are not copied.

Expected behavior:
Named items are duplicated too. Treat them as local in the sheet or treat them as they are defined in Excel.
Comment 1 tommy27 2014-07-12 08:14:50 UTC
I do not reproduce it on 4.2.0.4 and 4.2.5.2 using Win7x64

I did these steps:
- right click on the sheet tab
- select move/copy 
- click OK

the duplicated sheet looks exactly the same as the original
am I missing something?
Comment 2 Torge Riedel 2014-07-13 08:48:19 UTC
I just reproduced it on 4.2.5.2 using Win7x64:

Yes, the sheets look exactly the same after duplication, but there is a small difference:

In Calc/Excel you can give ranges/cells specific names. In general, a cell can be accessed by its "coordinates" like A1 (the top-left cell). But you can give it a "name" which can be used in formula or by external programs filling data into the sheet.

If you open the example xls and select the top-left cell (A1), you see in the combo box left of the formula field, that it has a name "ExportTitle". The same is with cell B2, which has the name "ExportDate".

If you duplicate this sheet in Calc, the new sheet is missing this names. If you do this with MS Excel, the cells A1 and B2 keep their names in the new sheet.

Hope, that this makes the problem more clear.
Comment 3 ign_christian 2014-07-13 09:11:22 UTC
Hi Torge, please see Bug 75372. Looks very similar..

Btw I can confirm cell names not copied to another sheet, just the values that copied. I also saw in different bugs, indeed there are some problems in copying cell names (to internal & external file).

Tested in 4.2.5.2 (Ubuntu 12.04 x86)
Comment 4 ign_christian 2014-07-13 09:18:52 UTC
(In reply to comment #0)
> I think the reason ist, that in the original Excel file the named items are
> local in the sheet, but treated global in LibreOffice. That's why they are
> not copied.
 
Anyway..you said those names is local name ? I saw those as global name. 
Your file created using Excel? Which version?
Comment 5 Torge Riedel 2014-07-13 09:28:11 UTC
(In reply to comment #3)
> Hi Torge, please see Bug 75372. Looks very similar..
> 
> Btw I can confirm cell names not copied to another sheet, just the values
> that copied. I also saw in different bugs, indeed there are some problems in
> copying cell names (to internal & external file).
> 
> Tested in 4.2.5.2 (Ubuntu 12.04 x86)

Yes, that bug looks very similar.
Comment 6 Torge Riedel 2014-07-13 09:33:54 UTC
(In reply to comment #4)
> (In reply to comment #0)
> > I think the reason ist, that in the original Excel file the named items are
> > local in the sheet, but treated global in LibreOffice. That's why they are
> > not copied.
>  
> Anyway..you said those names is local name ? I saw those as global name. 
> Your file created using Excel? Which version?

Yes, that file is created with Excel, since the application is used in different environments. Some (still) with Excel, some with Calc. File is created using MS Excel 2003 SP 3 (11.8404.8405).

As I understand, names are always local in Excel. But I'm not sure.
Comment 7 ign_christian 2014-07-13 09:49:51 UTC
> As I understand, names are always local in Excel. But I'm not sure.
Unfortunately I don't have Excel so can't confirm :(
Because, maybe, dev need new bug report for that import problem.

I don't know whether this should be mark as duplicate to Bug 75372 ?
Just add that bug in See Also..
Comment 8 Kevin Suo 2014-07-14 07:50:31 UTC
Hi, this is not a bug, see my comment in https://bugs.freedesktop.org/show_bug.cgi?id=75372#c2

For attachment 96250 [details], if you copy the first sheet, names are not duplicated because they are global. Cells in the duplicated sheet will refer to cell values in the 1st sheet.

Also, I do see that in MSO if you copy the first sheet, names are duplicated and scopes are set as sheet2. But I dont think this is a bug in libreoffice.

If you want the names be duplicated, you should set the scope as not global.

Set as NOTABUG. Feel free to reopen if someone disagree.
Comment 9 Kevin Suo 2014-07-14 08:14:35 UTC
Sorry, I think I'd rather reopen this bug....

If I copy the 1st sheet to "New File", the named ranges are lost (no matter if the scope is Global or not). This is really a bug, and I think this is want the bug reporter is talking about.

If copy and append to the same file, it works as I expected.
Comment 10 ign_christian 2014-07-14 09:00:48 UTC
I just wanted to comment in Bug 75372 about global name. But I think comment should be put here.

Set Platform All as I can also reproduced in LO 4.2.5.2 - Ubuntu 12.04x86

Taken from https://bugs.freedesktop.org/show_bug.cgi?id=75372#add_comment :
> In MSO 2010, if you copy a sheet (to the same file), when named ranges in
> the original is "global", then: it created a new named range with the same
> name, but the scope is set to the duplicated sheet.
I saw Kingsoft 2013 behaves similar with MSO 2010, like your observation. 
And copied sheet will be local name, but original sheet still global.

So LO behaves a bit different. (same as AOO 4.1.0)

@Kevin, what do you observed in MSO (comment 6 and comment 7) ? Should we open new import bug if you confirm that ?
Comment 12 Kevin Suo 2014-07-14 09:22:46 UTC
(In reply to comment #6)
> As I understand, names are always local in Excel. But I'm not sure.

Names are by default Global in MSO. 
(They don't call it "Global", they call it "Workbook", which means the current spreadsheet file.)
Comment 13 ign_christian 2014-07-14 10:01:48 UTC
(In reply to comment #12)
> Names are by default Global in MSO. 
> (They don't call it "Global", they call it "Workbook", which means the
> current spreadsheet file.)
So it's the same as Kingsoft then. no problem with LO import
Comment 14 Joel Madero 2014-11-05 04:02:15 UTC
I am hesitantly moving this to NEW - if confirmation is still needed please place into UNCONFIRMED. Thanks
Comment 15 QA Administrators 2015-12-20 16:09:35 UTC Comment hidden (obsolete)
Comment 16 Torge Riedel 2016-02-28 11:37:57 UTC
This bug is still present in 5.1.0.3 on Linux and Windows. No change of behaviour yet.
Comment 17 Eike Rathke 2016-03-18 23:56:45 UTC

*** This bug has been marked as a duplicate of bug 75372 ***
Comment 18 Eike Rathke 2016-03-24 15:14:14 UTC
Hum.. this is not exactly a duplicate of bug 75372, the names aren't referenced anywhere in formulas hence are not copied with a sheet-copy action, reopening.
Comment 19 Commit Notification 2016-04-29 22:32:45 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=02a8589553b5ce0e57a7ee9e66327376125b4378

Resolves: tdf#76523 copy used names or pointing to sheet to other document

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 Torge Riedel 2017-12-26 10:58:54 UTC
I can confirm that this is now (5.3.7.2) working and the bug is fixed for me.