Bug 46983

Summary: Macros: Macro to set filter in Calc does not work with .StringValue
Product: LibreOffice Reporter: folke7
Component: BASICAssignee: Takeshi Abe <tabe>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: libreofficebrab, sasha.libreoffice
Version: 3.5.0 release   
Hardware: Other   
OS: All   
Whiteboard: BSA target:3.6.0 target:3.5.3
i915 platform: i915 features:
Attachments: calc example

Description folke7 2012-03-05 11:46:29 UTC
Created attachment 58042 [details]
calc example

Problem description: 

Steps to reproduce:
1. Download file attached and start macro 'filter'

OR

1. Open Calc and fill in cells A2:'1', A3:'libre'
2. Open Basic IDE, insert and start the following macro:

Sub Filter
 Dim oFilterDef as Object        'Filterdescriptor
 Dim oFilterfield as Object      'Filterkriterium
 Dim oArea as Object             'Filterarea
 
 oFilterfield = createUnoStruct("com.sun.star.sheet.TableFilterField")
 With oFilterfield
  .Field = 0
  .IsNumeric = False
  .Operator = com.sun.star.sheet.FilterOperator.EQUAL
  .NumericValue = 1
  .StringValue = "libre"
 end with
  
 oArea = ThisComponent.Sheets.getbyIndex(0).getCellRangebyPosition(0, 0, 3, 6) 
 oFilterDef = oArea.createFilterDescriptor(True)
 With oFilterDef
  .setFilterFields(Array(oFilterfield))
  .ContainsHeader = True
  .UseRegularExpressions = False
  .IsCaseSensitive = False
 end with
 oArea.Filter(oFilterDef)
end sub

Current behavior:
Macro filters the given .NumericValue (in the example it is set to '1' just for demonstration)

Expected behavior:
Macro should filter the .StringValue 'libre'. That works fine with LO 3.4, but not in version 3.5 (German). 

Struct com.sun.star.sheet.TableFilterField2 and com.sun.star.sheet.TableFilterField3 behave in the same way.

Platform (if different from the browser): 
tested on WindowsXP and Ubuntu 11.10
              
Browser: Opera/9.80 (Windows NT 5.1; U; de) Presto/2.10.229 Version/11.61
Comment 1 Takeshi Abe 2012-04-17 11:29:36 UTC
Reproduced with LibO 3.5.2 on Debian wheezy.
Comment 2 Not Assigned 2012-04-17 11:58:33 UTC
Takeshi Abe committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=84a1ca6d9136c71bf20514307876824c1f915c0a

fdo#46983 Macros: Macro to set filter in Calc does not work with .StringValue
Comment 3 Not Assigned 2012-04-17 12:20:55 UTC
Takeshi Abe committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5920b681eaf2f1203efd5af581827db2e1a81bc8&g=libreoffice-3-5

fdo#46983 Macros: Macro to set filter in Calc does not work with .StringValue


It will be available in LibreOffice 3.5.3.
Comment 4 Kohei Yoshida (inactive) 2012-04-18 07:28:30 UTC
This is fixed now.
Comment 5 sasha.libreoffice 2012-05-30 04:29:57 UTC
Thanks for fixing this bug

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.