Bug 99086 - NamedRanges.getByName().ReferencePosition.Column Err
Summary: NamedRanges.getByName().ReferencePosition.Column Err
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.1.1.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-04 16:08 UTC by DM
Modified: 2016-04-04 18:54 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Minimal spreadsheet exhibiting error (13.43 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-04-04 16:08 UTC, DM
Details

Note You need to log in before you can comment on or make changes to this bug.
Description DM 2016-04-04 16:08:02 UTC
Created attachment 124070 [details]
Minimal spreadsheet exhibiting error

Windows 10
I have two named ranges in the same column, but their ReferencePosition.Column values are different, when I would anticipate them to be the same.

The attached spreadsheet (cut down from the one I was working on to bare essentials) illustrates this, with the okay range (Tst2) highlighted green and the bad one (DataW1C) red. You can see if you choose the named ranges from the gui droplist that they jump to these locations.
They have the same column, but if you open spreadsheet (enable macros) and run the Main() code, which is below, the code reports different columns.
Cheers,
David

SPREADHEET CODE:

Option Explicit
Sub Main()
Msgbox ThisComponent.NamedRanges.getByName("DataW1C").ReferencePosition.Column ' Fail (Red)
Msgbox ThisComponent.NamedRanges.getByName("Tst2").ReferencePosition.Column ' Good (Green)
End Sub
Comment 1 Eike Rathke 2016-04-04 18:17:35 UTC
There is no error.
DataW1C was defined on 'BALANCED SL'.$I$8 to point to $'BALANCED SL'.$J$8
Tst2 was defined on 'BALANCED SL'.$J$4 to point to $'BALANCED SL'.$J$4
Which is the difference you get with ReferencePosition.Column
Don't confuse the reference position (the base cell address where the range is defined on) with a reference the expression is pointing to.
Comment 2 DM 2016-04-04 18:54:44 UTC
Thanks - I see that now!
.ReferredCells.RangeAddress.StartColumn seems to work better.
Thanks for your pointer. I did have an issue where ThisComponent.NamedRanges.getByName(NameString).Name<>NameString
ie where the wrong (but existing) ranges were being returned by name lookup so I assumed the fault had been here too. (For that other error, I recreated all the ranges and that went away.)
Cheers,
d