Bug 78522 - Macros: [REGRESSION] InsertByIndex works bad
Summary: Macros: [REGRESSION] InsertByIndex works bad
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Whiteboard: BSA
Keywords: possibleRegression
Depends on:
Reported: 2014-05-10 08:41 UTC by Teo91
Modified: 2015-12-15 10:55 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:

InsertByIndex comparison LO 4.1 - 4.2, before and after (193.84 KB, image/jpeg)
2014-05-10 08:41 UTC, Teo91
Test file .ods for InsertByIndex bug (11.21 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-05-10 08:42 UTC, Teo91

Note You need to log in before you can comment on or make changes to this bug.
Description Teo91 2014-05-10 08:41:41 UTC
Created attachment 98809 [details]
InsertByIndex comparison LO 4.1 - 4.2, before and after

Problem description:

Something works bad with "InsertByIndex", you can see the range is altered when the number of row to insert is equal or greater than 2.

Look at the image for a comparison between LO 4.1.x and LO 4.2

Here is the macro code where the issue is located:

sub bug
oSheet = ThisComponent.currentController.activeSheet
oSheet.getRows.insertByIndex(lrow, 2)
end sub

Try the attached .ods test file:

- there is the formula =SUM(A9:C9) 
- use InsertByIndex macro instruction to insert rows above existing ones and you will get an alteration of the range used by =SUM()
- same issue happens using =PRODUCT() and generally operations working on cells range.

Current behavior:

Range is changed when when the number of row to insert is equal or greater than 2.

Expected behavior:

InsertByIndex should work well with no range alteration, like in LO 4.1.x

Operating System: All
Version: release
Last worked in: release
Comment 1 Teo91 2014-05-10 08:42:41 UTC
Created attachment 98810 [details]
Test file .ods for InsertByIndex bug
Comment 2 Julien Nabet 2014-05-10 17:25:17 UTC
On pc Debian x86-64 with master sources updated today or with 4.2 updated yesterday, I don't reproduce this.
2 rows are inserted above the current row.
Comment 3 Teo91 2014-05-29 08:58:52 UTC
I tried LO 4.2.5 pre-release and this issue is no more.
Whatever was my bug, it's gone.
Comment 4 Robinson Tryon (qubit) 2015-12-15 10:55:00 UTC
Migrating Whiteboard tags to Keywords: (possibleRegression)