Bug 144299

Summary: SheetCellRanges service SEARCHING FOR STYLE cant FindAll or ReplaceAll if .Count=1 / simple SheetCellRange also can't.
Product: LibreOffice Reporter: Wolfgang Jäger <jag>
Component: sdkAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: ilmari.lauhakangas, jag
Priority: medium    
Version: 3.5.2 release   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 117710    
Attachments: the announced attachment

Description Wolfgang Jäger 2021-09-04 21:18:41 UTC
Created attachment 174779 [details]
the announced attachment

If a .FindAll(searchDescriptor) or a .ReplaceAll(searchDescriptor) is called from a SfheetCellRange service or from a SheetCellRanges service containing exactly one range (.Count=1) there is no action. 
The foundRanges is Null, and the replacement not executed.

This I recently experienced with LibO V 7.2.0.4, but also trying old versions (32 bit) I found that even a version as early as 3.5.2 ad the bug.  

I couldn't test with versions in-betwwen, but the heritage version 3.3. was not afflicted. (AOO 4.1.7 also isn't.)  

Trying the code contained in the attached example should exemplify the bug. 
Run it with only a single range of the first sheet selected --> failure
Select a second range OR the tab of the second sheet in addition --> success.
Comment 1 Wolfgang Jäger 2021-09-19 10:09:07 UTC
Sorryy!  
When reporting the bug I completely missed to emphasize (in fact I not even mentioned) the very important condition "searching for style".
The Basic code in the attached example is containing the lines 

With searchDe
  .SearchStyles = True
  .SearchString = workCS
End With

The search for 
  .SearchStyles = False
with an ordinary .SearchString is NOT afflicted.

Sorry
Comment 2 Buovjaga 2022-09-07 13:11:29 UTC
(In reply to Wolfgang Jäger from comment #0)
> Created attachment 174779 [details]
> the announced attachment
> Trying the code contained in the attached example should exemplify the bug. 
> Run it with only a single range of the first sheet selected --> failure
> Select a second range OR the tab of the second sheet in addition --> success.

I reproduce.

The failure error is:
Inadmissible value or data type.
Data type mismatch.

Pointing to line 17
For Each rg In csRgs

Arch Linux 64-bit
Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: f5c6ef40dd494f6984c6ed784fccc02806999836
CPU threads: 8; OS: Linux 5.19; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 7 September 2022