Skip to content

Commit

Permalink
Version 3
Browse files Browse the repository at this point in the history
  • Loading branch information
goosepirate committed Sep 19, 2022
1 parent e6807cb commit eb9d3b8
Show file tree
Hide file tree
Showing 13 changed files with 747 additions and 38 deletions.
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion LICENSE

This file was deleted.

23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,33 @@ Once Lox365 is installed, just use them like you would in Excel.
| [SORT](https://support.microsoft.com/en-us/office/sort-function-22f63bd0-ccc8-492f-953d-c20e8e44b86c) | SORT | Partial | 1 |
| [TEXTSPLIT](https://support.microsoft.com/en-us/office/textsplit-function-b1ca414e-4c21-4ca0-b1b7-bdecace8a6e7) | TEXTSPLIT | Partial | 2 |
| [TOCOL](https://support.microsoft.com/en-us/office/tocol-function-22839d9b-0b55-4fc1-b4e6-2761f8f122ed) | TOCOL | Partial | 3 |
| [XLOOKUP](https://support.microsoft.com/en-us/office/xlookup-function-b7fd680e-6d10-43e6-84f9-88eae8bf5929) | XLOOKUP | Partial | 4 |
| [UNIQUE](https://support.microsoft.com/en-us/office/unique-function-c5ab87fd-30a3-4ce9-9d1a-40204fb85e1e) | UNIQUE | Partial | 4 |
| [XLOOKUP](https://support.microsoft.com/en-us/office/xlookup-function-b7fd680e-6d10-43e6-84f9-88eae8bf5929) | XLOOKUP | Partial | 5 |

Notes:

1. Not supported: `by_col`.
2. Not supported: `row_delimiter`, `ignore_empty`, `match_mode`, `pad_with`.
3. Not supported: `ignore`, `scan_by_column`.
4. Not supported: `match_mode`, `search_mode`.
4. Not supported: `by_col`, `exactly_once`.
5. Not supported: `match_mode`, `search_mode`.

## Why

I use these functions quite often in Excel and wanted to use them in LibreOffice too, so I made this. Contributions are welcome.

## More functions

These functions are available in the latest Excel but not in LibreOffice, and not (yet) provided by Lox365:
These functions are not in LibreOffice and not provided by Lox365 but are available in the latest Excel:

* RANDARRAY
* SEQUENCE
* SORTBY
* UNIQUE
* STOCKHISTORY
* TOROW
* XMATCH

These functions are already available in LibreOffice, so they're not provided by Lox365:
These functions are already available in LibreOffice:

* CONCAT
* IFS
Expand All @@ -61,4 +64,12 @@ https://bugs.documentfoundation.org/show_bug.cgi?id=126573

https://bugs.documentfoundation.org/show_bug.cgi?id=127293

https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1uno.html
https://gerrit.libreoffice.org/c/core/+/131905

https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1uno.html

https://wiki.openoffice.org/wiki/Calc/Add-In/Python_How-To

https://wiki.openoffice.org/wiki/Python/Python_Language_Binding

https://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/AddIn.html
11 changes: 11 additions & 0 deletions addin.xcu
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@
</node>
</node>
</node>
<node oor:name="UNIQUE" oor:op="replace">
<prop oor:name="DisplayName"><value xml:lang="en">UNIQUE</value></prop>
<prop oor:name="Description"><value xml:lang="en">Returns the unique values from a range or array. Provided by Lox365.</value></prop>
<prop oor:name="Category"><value>Add-in</value></prop>
<node oor:name="Parameters">
<node oor:name="array" oor:op="replace">
<prop oor:name="DisplayName"><value xml:lang="en">Array</value></prop>
<prop oor:name="Description"><value xml:lang="en">The array from which to return unique rows or columns.</value></prop>
</node>
</node>
</node>
<node oor:name="XLOOKUP" oor:op="replace">
<prop oor:name="DisplayName"><value xml:lang="en">XLOOKUP</value></prop>
<prop oor:name="Description"><value xml:lang="en">Searches a range or an array for a match and returns the corresponding item from a second range or array. Provided by Lox365.</value></prop>
Expand Down
Binary file modified build/Lox365.oxt
Binary file not shown.
Binary file modified build/interface.rdb
Binary file not shown.
Binary file modified build/interface.urd
Binary file not shown.
2 changes: 1 addition & 1 deletion description.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:xlink="http://www.w3.org/1999/xlink">
<identifier value="com.goosepirate.lox365.oxt" />
<icon><default xlink:href="icon.png" /></icon>
<version value="2.0" />
<version value="3.0" />
<publisher><name xlink:href="https://github.com/goosepirate/lox365" lang="en">goosepirate</name></publisher>
<display-name><name lang="en">Lox365</name></display-name>
<extension-description><src xlink:href="extension-description.txt" lang="en"/></extension-description>
Expand Down
5 changes: 5 additions & 0 deletions interface.idl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// #include <com/sun/star/beans/XPropertySet.idl>
// #include <com/sun/star/table/XCellRange.idl>
#include <com/sun/star/uno/XInterface.idl>

module org { module openoffice { module sheet { module addin {
Expand Down Expand Up @@ -28,6 +30,9 @@ module org { module openoffice { module sheet { module addin {
sequence< sequence< any > > TOCOL(
[in] sequence< sequence< any > > array
);
sequence< sequence< any > > UNIQUE(
[in] sequence< sequence< any > > array
);
sequence< sequence< any > > XLOOKUP(
[in] any lookupValue,
[in] sequence< sequence< any > > lookupArray,
Expand Down
3 changes: 2 additions & 1 deletion loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
class Lox365(unohelper.Base, XLox365):
def __init__(self, ctx): self.ctx = ctx

def DBG_ECHO (self, *args): return lx.DBG_ECHO(*args)
def DBG_ECHO (self, *args): return lx.DBG_ECHO(*args)
def DBG_ECHO2(self, *args): return lx.DBG_ECHO2(*args)
def DBG_ECHO3(self, *args): return lx.DBG_ECHO3(*args)

def FILTER (self, *args): return lx.FILTER(*args)
def SORT (self, *args): return lx.SORT(*args)
def TEXTSPLIT(self, *args): return lx.TEXTSPLIT(*args)
def TOCOL (self, *args): return lx.TOCOL(*args)
def UNIQUE (self, *args): return lx.UNIQUE(*args)
def XLOOKUP (self, *args): return lx.XLOOKUP(*args)

def createInstance(ctx):
Expand Down
58 changes: 29 additions & 29 deletions pythonpath/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pythonpath/lox365.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def TOCOL(array):
result.append((item,))
return tuple(result)

def UNIQUE(array):
return tuple(dict.fromkeys(array))

def XLOOKUP(lookupValue, lookupArray, returnArray, ifNotFound=ERR_NA):
if not ifNotFound: ifNotFound = ERR_NA
lookup_direction = 0 # 0 is vertical; 1 is horizontal
Expand Down
5 changes: 5 additions & 0 deletions pythonpath/test_lox365.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ def test_TOCOL():
assert TOCOL(((0,'b'),('c',0))) == ((0,),('b',),('c',),(0,))
assert TOCOL(((0,),)) == ((0,),)

def test_UNIQUE():
'''Typical'''
assert UNIQUE((('b',),('a',),('b',),('a',))) == \
(('b',),('a',))

def test_XLOOKUP():
'''Typical'''
assert XLOOKUP('C',
Expand Down

0 comments on commit eb9d3b8

Please sign in to comment.