Bug 47479 - LibO Calc Macro .getCellRangeByName with named range
Summary: LibO Calc Macro .getCellRangeByName with named range
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.5.1 release
Hardware: x86-64 (AMD64) Windows (All)
: high major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro-UNOAPI
  Show dependency treegraph
 
Reported: 2012-03-18 12:42 UTC by Kossem
Modified: 2021-09-18 03:26 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kossem 2012-03-18 12:42:23 UTC
I got an error message after updating Calc to LibO 3.5(.0 and still now with .1.2) when running a previously flawless macro.
The offending (?) statement is  .getCellRangeByName("namedcell")  where namedcell is a global named cell range (of one cell, in this instance).

Response from system:

    Basic runtime error.
    An exception occurred
    Type: com.sun.star.uno.RuntimeException
    Message:.

The (empty) returned message is quite cryptic, without any error number to start searching.

- Same error when tried with a multiple cells named range, and with different (plain and short) names for the range.
- It works well when the named cell range is replaced by its coordinates value (e.g. "K12").
- Works also ok with getCellByPosition (but I want it to work correctly, as it did before, with a named cell range).

Thanks in advance for a fast and complete solution, and/or explanation.
Cheers.
Comment 1 Jeremy 2013-04-08 11:31:34 UTC
I am getting the same error on 4.0.2.2 and previous release.  I only get the error if I have deleted a range.
The following code will recreate the problem.  Sheet1 has a single range defined as "MYRANGE" and there is some data in the following cells.

Sub Main
Dim oSheet as Object
DIM cBlock as New com.sun.star.table.CellRangeAddress
dim myRow as integer

oSheet = ThisComponent.sheets("Sheet1")
myRow=oSheet.getCellRangeByName("MYRANGE").RAngeAddress.EndRow


cBlock.Sheet=0
cBlock.StartColumn=0
cBlock.EndColumn=4
cBlock.StartRow=myRow+1
cBlock.EndRow=myRow+2
osheet.removeRange(cBlock, com.sun.star.sheet.CellDeleteMode.UP)

myRow=oSheet.getCellRangeByName("MYRANGE").RAngeAddress.EndRow ' << fails here

End Sub
Comment 2 Jeremy 2013-05-16 09:46:20 UTC
Still a problem in 4.0.3.3
Comment 3 QA Administrators 2015-04-19 03:20:48 UTC Comment hidden (obsolete)
Comment 4 Buovjaga 2015-06-15 12:45:09 UTC
Repro per comment 1.

Win 7 Pro 64-bit Version: 5.1.0.0.alpha1+
Build ID: 01a189abcd9a4ca472a74b3b2c000c9338fc2c91
TinderBox: Win-x86@39, Branch:master, Time: 2015-06-14_07:46:28
Locale: fi-FI (fi_FI)
Comment 5 Xisco Faulí 2017-06-12 10:54:09 UTC
Changing version back to the earliest version affected.
Comment 6 QA Administrators 2018-06-17 02:43:42 UTC Comment hidden (obsolete)
Comment 7 Buovjaga 2019-08-11 10:23:52 UTC
(In reply to Jeremy from comment #1)
> I am getting the same error on 4.0.2.2 and previous release.  I only get the
> error if I have deleted a range.
> The following code will recreate the problem.  Sheet1 has a single range
> defined as "MYRANGE" and there is some data in the following cells.
> 
> Sub Main
> Dim oSheet as Object
> DIM cBlock as New com.sun.star.table.CellRangeAddress
> dim myRow as integer
> 
> oSheet = ThisComponent.sheets("Sheet1")
> myRow=oSheet.getCellRangeByName("MYRANGE").RAngeAddress.EndRow
> 
> 
> cBlock.Sheet=0
> cBlock.StartColumn=0
> cBlock.EndColumn=4
> cBlock.StartRow=myRow+1
> cBlock.EndRow=myRow+2
> osheet.removeRange(cBlock, com.sun.star.sheet.CellDeleteMode.UP)
> 
> myRow=oSheet.getCellRangeByName("MYRANGE").RAngeAddress.EndRow ' << fails
> here
> 
> End Sub

I put numbers in A1-8 and defined A1-A4 as MYRANGE. I ran the macro and it did not fail. The macro removes two rows after the range.

Is there something I am missing?

Arch Linux 64-bit
Version: 6.4.0.0.alpha0+
Build ID: 37fc9f51a8de11d40632e8cda17ccf1fa4b1f503
CPU threads: 8; OS: Linux 5.2; UI render: default; VCL: gtk3; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 6 August 2019
Comment 8 QA Administrators 2021-09-18 03:26:54 UTC
Dear Kossem,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug