Bug 72196

Summary: FILTER: Implement ODF 1.2 HOST-USE-WILDCARDS
Product: LibreOffice Reporter: Sebastian Sauer <mail>
Component: SpreadsheetAssignee: Not Assigned <libreoffice-bugs>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: medium CC: andreas.sturmlechner, erack, gerard.fargeot, jorendc, moolang, vulcain, winfrieddonkers
Version: unspecified   
Hardware: Other   
OS: All   
See Also: https://issues.apache.org/ooo/show_bug.cgi?id=32344
Whiteboard: BSA
i915 platform: i915 features:

Description Sebastian Sauer 2013-12-01 15:19:11 UTC
Formulas like SUMIF and COUNTIF support in Excel Wildcards (like * and ?) and in ODF regular expression (pregex). ODF 1.2 defines to support both and switch via a config-option between none/wildcard/regex. LibreOffice needs to support wildcards to be compatible with XLS/XLSX and with ODF 1.2.

See related bugreport in OpenOffice.org (from 2005, wo pre-fork time and still applies to LO and AOO):
https://issues.apache.org/ooo/show_bug.cgi?id=32344

Related section in the ODF 1.2 specs:
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#__RefHeading__1017868_715980110

Operating System: All
Version: unspecified
Comment 1 Jorendc 2013-12-01 15:26:26 UTC
@Winfried: any chance you can confirm this one?

Thanks for your expertise,
Joren
Comment 2 Sebastian Sauer 2013-12-01 19:19:14 UTC
Some details how to reproduce (sry, don't have msexcel at hand atm to produce+attach xls/xlsx):

Sheet:
    A         B
1   test1     11
2   test2     22

Formula:
=SUMIF(A1:A2, "test*", B1:B2)

Result in OO/LO:
0

Expected as shown in Excel which only knows about the wildcard-mode:
33

Now change the formula in LO to (note that "*" becomes ".*"):
=SUMIF(A1:A2, "test.*", B1:B2)
and active the ODF regexp-mode in Tools=>Options=>LO Calc=>Calculation=>Enbable regular expressions in formulas.
33 is displayed.

Problems:
1. regex vs wildcards where LO only supports regex.
2. when importing Excel xls/xlsx users need to manually change wildcards to regular expressions.
3. after done users need to manually enable regex in formulas in the options.
4. on export to xls/xlsx users need to manually change regex back to wildcards else Excel will produce different results cause it only supports wildcards and not regex.
5. Incompatible with any other ODF producer/consumer that supports HOST-USE-WILDCARDS.

Many problems. Point 2 is a real deal-breaker cause it makes it impossible for Excel spreadsheet-producers to also cover LibreOffice (eg by runtime-determination in a sheet if it runs in LO and then use regex in formulas rather then wildcards) without user-interaction. Since there are no alternates to functionality like SUMIF+wildcards and since lot of basic formulas are affected lot of use-case scenarios cannot be done in a compatible way :-/
Comment 3 Sebastian Sauer 2013-12-01 19:25:15 UTC
Meaned point 3 is the deal-breaker since workaround impossible whereas when LO at least enables regex-mode on xls/xlsx-import spreadsheet-authors could work around. The ideal and 100% compatible that not needs any workarounds solution would be to just implement support for wildcards and enable wildcard-mode on xls/xlsx-import.
Comment 4 Winfried Donkers 2013-12-02 08:43:10 UTC
(In reply to comment #1)
> @Winfried: any chance you can confirm this one?
> 
> Thanks for your expertise,
> Joren

@Joren,
AFAICS, the support of wild cards in calc formulas is not yet implemented in LibreOffice. I have no access to Excel, so I can't confirm that an Excel document with wild cards in formulas is not processed as one would expect.
Given that Eike has been added to the CC, Eike already was involved with the OOo bug report mentioned in comment 1 and Eike is the real expert on this, I leave further commenting to Eike.
Comment 5 Eike Rathke 2013-12-04 20:29:45 UTC
Well, what shall I say.. the "simple" wildcards are not implemented. Means they have to be implemented at utl::TextSearch, a Calc option to be introduced similar to the regular expressions option under Tools->Options (mutually exclusive), an option in the Find&Replace dialog (mutually exclusive), the ScQueryParam needs to transport it (similar to bRegExp), ScTable::ValidQuery() needs to support it, queries at ScMatrix need to support it, reading the setting from / writing to ODF files needs to be implemented and enabling the Calc option when importing Excel files. I probably forgot something.
Comment 6 Sebastian Sauer 2013-12-18 20:05:35 UTC
Added support for none/regex/wildcards to Calligra Sheets with https://projects.kde.org/projects/calligra/repository/revisions/a63d4e13fe7ce54c8a751e06c8e6eab424cb6377
That means there is at least one ODF producer out there now writing ODS files using HOST-USE-WILDCARDS formulas not proper evaluated by LO/AOO.
Comment 7 Goran Rakic 2014-10-20 11:24:30 UTC
*** Bug 38125 has been marked as a duplicate of this bug. ***
Comment 8 andreas.sturmlechner 2014-12-20 19:30:48 UTC
(In reply to Winfried Donkers from comment #4)
> I have no access to Excel, so I can't confirm that an Excel
> document with wild cards in formulas is not processed as one would expect.

I just got hit by this - actually, I noticed the same bug in CPAN's Spreadsheet::ParseExcel, then opened the document in LibreOffice to check what's going on and looked at a completely different calculated tax sum as compared to Excel 2010.

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.