When the findAll or replaceAll methods are called from the com.sun.star.sheet.SheetCellRanges service, the result include more cells than expected if the ranges of the collection are spread over several sheets.
Steps to Reproduce:
Hereafter, a sample of code that reproduces the problem.
Step to reproduce :
1. quit LibreOffice.
2. save the script into the Scripts/python path of your user profile
3. execute the script with the command : <libo_install_path>/program/soffice 'vnd.sun.star.script:cellranges_replace.py$replace?language=Python&location=user'
If the following ranges are added to an empty SheetCellRanges collection :
the searched value is found (and replaced) on the following ranges :
whereas the last two ranges are not part of the collection.
The scope of the findAll and replaceAll methods should be restricted to the ranges that are parts of the collection.
User Profile Reset: Yes
This bug yet exists in LibreOffice 6.0.1.
A workaround is to browse ranges in the collection and call the findAll / replaceAll methods on each of theses ranges.
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Created attachment 140105 [details]
A piece of code that reproduce the problem.
I get this error when I run it:
Message: <class 'pythonscript.com.sun.star.ucb.InteractiveAugmentedIOException'>: an error occurred during file opening
File "/home/user/libreoffice/instdir/program/pythonscript.py", line 998, in getScript
mod = self.provCtx.getModuleByUrl( fileUri )
File "/home/user/libreoffice/instdir/program/pythonscript.py", line 435, in getModuleByUrl
lastRead = self.sfa.getDateTimeModified( url )
What should I do?
I reproduce your error when the location of the script is not the expected one.
Can you check the location of the script in your user profile ?
It must be exactly "Script/python".
This path is case sensitive so "Script/Python" is not recognized by LibreOffice for example.
Now I tried to force the path as absolute, but it just opens LibreOffice start center and nothing happens:
How can I force it?
I'm not sure an absolute path is allowed.
The given path seems to be the shared profile of your build.
May be you can try 'location=shared' instead of 'location=user' in the command.
Otherwise try this way :
- open LibreOffice
- go to Tools > Macros > Organize macros > Python...
- you should see the cellranges_replace script either in 'My macros' or in 'LibreOffice macros'
- select the replace method and click on 'Run'.
I made a mistake in my previous message : it's not 'location=shared' but 'location=share'
Created attachment 140528 [details]
Screenshot of result
Thanks, location=share worked! Attached is the result, is it the incorrect one?
Arch Linux 64-bit
Build ID: b8fe96f1da2c42c04a8094ca8c57d49763b7bded
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: kde4;
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on March 8th 2018
Oh, right, it gives this output in the terminal:
target collection : $asheet.$B$2:$C$3;$anothersheet.$F$6:$G$7
findAll collection : $asheet.$B$2:$C$3;$asheet.$F$6:$G$7;$anothersheet.$B$2:$C$3;$anothersheet.$F$6:$G$7
findAll count : 16
replaceAll count : 16
Yes that's the incorrect result.
The terminal output shows there is two ranges on two different sheets in the collection, $asheet.$B$2:$C$3 and $anothersheet.$F$6:$G$7,
but on the attached result the ranges B2:C3 and F6:G7 are replaced on the same sheet.
** Please read this message in its entirety before responding **
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 http://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!
This bug yet exists in LibreOffice 6.2.2 :
User Profile Reset: Yes
Informations from 'Help - About LibreOffice' :
Build ID: 2b840030fec2aae0fd2658d8d4f9548af4e3518d
Threads CPU : 4; OS : Linux 4.9; UI Render : par défaut; VCL: gtk3;
Locale : fr-FR (fr_FR.utf8); Langue IHM : fr-FR