Bug 70079 - Basic: after sheets.copybyname or sheets.remove basic-variable points to wrong sheet
Summary: Basic: after sheets.copybyname or sheets.remove basic-variable points to wro...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version: 4.1.1.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
QA Contact:
URL:
Whiteboard: target:4.3.0
Keywords:
: 70081 70754 74118 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-10-03 14:13 UTC by uwe lengler
Modified: 2014-10-09 13:16 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
bug example (8.09 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-10-27 11:08 UTC, Eugenij Shkrigunov
Details
fix (1.38 KB, patch)
2013-10-29 12:59 UTC, Eugenij Shkrigunov
Details | Splinter Review

Description uwe lengler 2013-10-03 14:13:14 UTC
basic variable = sheets.getbyname(..)
After inserting a new sheet with sheets.copybyname before this sheet , the basic variable points to the wrong sheet, here sheetpositon -1. You get the same effect after removing a sheet, the variable points then to sheetpositon+1.

The problem is new in  this LO version. A retest in LO 4.0 is OK.

REM  *****  BASIC  *****
global otabledoc as variant
Sub Main
oTableDoc=ThisComponent
oSheets = oTableDoc.sheets
if osheets.hasbyname("Tabellenew") then
  osheets.removebyname("Tabellenew")
endif

Sheet1 = oSheets.GetbyName("Tabelle1")
oSheets = oTableDoc.sheets
'msgbox osheets.dbg_methods

osheets.copybyname(sheet1.name,"Tabellenew",0) 'because 3.Parameter = 0 -->  insert the new sheet before the sheet1 Tabelle1
'if you insert the new sheet after the old sheet, everything is ok.

Sheet1.getCellByPosition(0,0).string=sheet1.name 'write to the sheet Tabellenew, not to the sheet Tabelle1

End Sub
Comment 1 uwe lengler 2013-10-03 15:12:33 UTC
*** Bug 70081 has been marked as a duplicate of this bug. ***
Comment 2 Eugenij Shkrigunov 2013-10-23 07:41:56 UTC
*** Bug 70754 has been marked as a duplicate of this bug. ***
Comment 3 Eugenij Shkrigunov 2013-10-27 11:08:53 UTC
Created attachment 88172 [details]
bug example
Comment 4 Eugenij Shkrigunov 2013-10-27 11:13:27 UTC
Also getByIndex (see bug example).
Seems that affected all documents that assign variable = ThisComponent.Sheets. ...
Please, fix this bug in 4.1.3.
Comment 5 Eugenij Shkrigunov 2013-10-29 12:59:06 UTC
Created attachment 88289 [details] [review]
fix

A Sheet.RangeAddress does not get updated on copy or move.
Comment 6 Eugenij Shkrigunov 2013-11-12 09:28:48 UTC
Include the fix in next release, please.
Comment 7 Michael Stahl 2013-11-13 12:19:46 UTC
there's some patch attached here - could some Calc developer please take a look?

Eugenij, it's best to send patches to gerrit - in bugzilla they are usually only found by accident, months later....

https://wiki.documentfoundation.org/Development/gerrit
Comment 8 Eugenij Shkrigunov 2013-11-13 12:36:42 UTC
(In reply to comment #7)
> there's some patch attached here - could some Calc developer please take a
> look?
> 
> Eugenij, it's best to send patches to gerrit - in bugzilla they are usually
> only found by accident, months later....
> 
> https://wiki.documentfoundation.org/Development/gerrit

Michael, thanks for the tip. I looked at the link. Sorry, I have no experience with git.
Comment 9 Commit Notification 2014-02-03 11:43:36 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=8eec79e595eb651cd41e2f6a1918af67c4d43cf7

Revert "fix Worksheet.Cells by now allowing TableSheet..." fdo#70079



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 10 Noel Power 2014-02-03 11:44:22 UTC
*** Bug 74118 has been marked as a duplicate of this bug. ***
Comment 11 mms 2014-10-09 13:16:51 UTC
Just wanted to let you know that this bug is still present in version 4.2.6.3!

It gave me a headache as my macro wasn't working anymore until I found this bug here! 

As it is quite old, I thought it should have been fixed already!?


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.