51 Commits

Author SHA1 Message Date
Nicolás Hatcher Andrés
330a018202 FIX: Adds test for TIME/HOUR/MINUTE/SECOND (#456) 2025-10-19 15:38:11 +02:00
Brian Hung
dd4467f95d date time functions (#425)
* merge networkdays, networkdays.intl #33

* merge time, timevalue, hour, minute, second #35

* merge datedif, datevalue #36

* merge days, days360, weekday, weeknum, workday, workday.intl, yearfrac, isoweeknum #41

* from excel helper

* fix build

* date time macros

* de-dupe weekend

* serial helper

* de-dupe now today

* weekend pattern enum

* remove unused clippy wrong self

* fix docs

* add test coverage

* fix build

* fix cursor comment

* PR coments + xlsx date time
2025-10-19 10:19:19 +02:00
Nicolás Hatcher
fdeae2c771 UPDATE: Add templates 2025-09-28 12:46:16 +02:00
Nicolás Hatcher
f581ce5570 FIX: Update xlsx test for ROUND, ROUNDUP 2025-08-09 10:43:19 +02:00
Nicolás Hatcher
faa0ff9b69 FIX: Minimal support for inlineStr
Fixes #424
2025-08-02 12:55:56 +02:00
Nicolás Hatcher
2a5f001361 UPDATE: Adds LOG10 and LN for Elsa 2025-07-13 00:10:32 +02:00
Nicolás Hatcher
0be7d9b85a FIX: Make clippy happy 2025-06-29 11:07:05 +02:00
Nicolás Hatcher
e5ec75495a UPDATE: Introducing Arrays
# This PR introduces:

## Parsing arrays:

{1,2,3} and {1;2;3}

Note that array elements can be numbers, booleans and errors (#VALUE!)

## Evaluating arrays in the SUM function

=SUM({1,2,3}) works!

## Evaluating arithmetic operation with arrays

=SUM({1,2,3} * 8) or =SUM({1,2,3}+{2,4,5}) works

This is done with just one function (handle_arithmetic) for most operations

## Some mathematical functions implement arrays

=SUM(SIN({1,2,3})) works

This is done with macros. See fn_single_number
So that implementing new functions that supports array are easy


# Not done in this PR

## Most functions are not supporting arrays

When that happens we either through #N/IMPL! (not implemented error)
or do implicit intersection. Some functions will be rather trivial to "arraify" some will be hard

## The final result in a cell cannot be an array

The formula ={1,2,3} in a cell will result in #N/IMPL!

## Exporting arrays to Excel might not work correctly

Excel uses the cm (cell metadata) for formulas that contain dynamic arrays.
Although the present PR does not introduce dynamic arrays some formulas like =SUM(SIN({1,2,3}))
is considered a dynamic formula

## There are not a lot of tests in this delivery

The bulk of the tests will be added once we start going function by function# This PR introduces:

## Parsing arrays:

{1,2,3} and {1;2;3}

Note that array elements can be numbers, booleans and errors (#VALUE!)

## Evaluating arrays in the SUM function

=SUM({1,2,3}) works!

## Evaluating arithmetic operation with arrays

=SUM({1,2,3} * 8) or =SUM({1,2,3}+{2,4,5}) works

This is done with just one function (handle_arithmetic) for most operations

## Some mathematical functions implement arrays

=SUM(SIN({1,2,3})) works

This is done with macros. See fn_single_number
So that implementing new functions that supports array are easy


# Not done in this PR

## Most functions are not supporting arrays

When that happens we either through #N/IMPL! (not implemented error)
or do implicit intersection. Some functions will be rather trivial to "arraify" some will be hard

## The final result in a cell cannot be an array

The formula ={1,2,3} in a cell will result in #N/IMPL!

## Exporting arrays to Excel might not work correctly

Excel uses the cm (cell metadata) for formulas that contain dynamic arrays.
Although the present PR does not introduce dynamic arrays some formulas like =SUM(SIN({1,2,3}))
is considered a dynamic formula

## There are not a lot of tests in this delivery

The bulk of the tests will be added once we start going function by function

## The array parsing does not respect the locale

Locales that use ',' as a decimal separator need to use something different for arrays

## The might introduce a small performance penalty

We haven't been benchmarking, and having closures for every arithmetic operation and every function
evaluation will introduce a performance hit. Fixing that in he future is not so hard writing tailored
code for the operation
2025-03-17 20:04:47 +01:00
Nicolás Hatcher
da017b6113 UPDATE: Implement the implicit Intersection Operator
The II operator takes a range and returns a single cell that is in the same column or the same row
as the present cell.

This is needed for backwards compatibility with old Excel models and as a first step towards dynamic arrays.

In the past Excel would evaluate `=A1:A10` in cell `C3` as `A3`, but today in results in an array containing all
values in the range. To be compatible with old workbooks Excel inserts the II operator
on those cases.

So this PR performs an static analysis on all formulas inserting on import automatically the II operator
where necessary. This we call the _automatic implicit operator_. When exporting to Excel the operator is striped away.
You can also manually use the II. For instance `=SUM(@A1:A10)` in cell `C3`.
This was not possible before and such a formula would break backwards compatibility with Excel. To Excel that "non automatic"
form of the II is exported as `_xlfn.SINGLE()`.

Th static analysis has to be done for all arithmetic operations and all functions.
This is a bit of a daunting task and it is not done fully in this PR. We also need to implement arrays and dynamic arrays.
My believe is that once the core operations have been implemented we can go formula by formula writing proper tests and documentation.

After this PR formulas like `=A1:A10` for instance will return `#N/IMPL!` instead of performing the implicit intersection
2025-03-03 21:59:42 +01:00
Nicolás Hatcher
4095b7db6e UPDATE[API rename]: set_column_with => set_columns_with
Similarly set_row_height => set_rows_height
2025-02-19 18:26:49 +01:00
Nicolás Hatcher
264fcac63c UPDATE: Exposes the model in UserModel
Fixes #262
2025-01-30 07:50:14 +01:00
Steve Fanning
81d25b6ec9 Add ERFC, ERF.PRECISE and ERFC.PRECISE functions 2025-01-20 17:22:33 +01:00
Steve Fanning
2e0722f9b5 Fix typos in ERF function description 2025-01-18 10:56:51 +01:00
Steve Fanning
fd72bca141 Add description for ERF function. 2025-01-18 10:56:51 +01:00
Steve Fanning
ac9dc22972 Minor updates to DAY function page and example spreadsheet 2025-01-02 18:29:12 +01:00
Steve Fanning
02e726b445 Add YEAR function description 2025-01-02 18:19:43 +01:00
Steve Fanning
99e1110261 Add MONTH function description 2025-01-02 18:18:12 +01:00
Steve Fanning
564d4bac7a Add DAY function description 2025-01-01 11:44:44 +01:00
Shalom Yiblet
0dd26e8fee fix: fix xml escape in worksheet xml 2024-12-31 09:07:39 +01:00
Nicolás Hatcher
c6adf8449b FIX: Dates are only valid up to the last day of 9999 2024-12-30 14:15:09 +01:00
Shalom Yiblet
d04691b790 refactor(dates): adjust date handling logic for improved accuracy
Updated the logic for handling months and days to improve date calculations. Also modified the constants for Excel date ranges to align with supported dates.
2024-12-30 13:12:33 +01:00
Nicolás Hatcher
b859af1dc4 FIX: Disable TAN from being tested 2024-12-29 13:28:56 +01:00
Steve Fanning
f9cfdeb35b Add TAN function description 2024-12-29 11:03:07 +01:00
Steve Fanning
e268dda9e8 Add SIN function description 2024-12-28 12:28:16 +01:00
Nicolás Hatcher
e0205d6c9a FIX: Increments the dum counter in the number of documented functions 2024-12-28 10:55:09 +01:00
Steve Fanning
81ad724348 Add COS function description 2024-12-28 10:46:32 +01:00
Steve Fanning
38023d3156 Include PV function description 2024-12-27 20:19:32 +01:00
Gian Hancock
8ba30fde33 Add more tests for OR and XOR
Some of these tests fail due to inconsistencies with Excel

cleanup
2024-12-26 15:06:54 +01:00
Steve Fanning
df4b4ca353 Update to FV description and associated pages in the Features area. 2024-12-25 13:47:21 +01:00
Nicolás Hatcher
23814ec18c FIX: Several fixes on the FV function
(1+x)^(1+y) was stringifyfied incorrectly
We still need work on this

FV now returns currency

FV(-1,-2,1) should return #DIV/0! not #NUM!
2024-12-14 22:08:44 +01:00
Nicolás Hatcher
41350fbd73 FIX: Run tests again and disable GEOMEAN test 2024-12-13 16:08:46 +01:00
Andrew Fillmore
d4a2289826 Add GEOMEAN .xlsx, Update .md files, and Run cargo fmt 2024-12-12 05:58:20 +01:00
stevethesleeve
17cf519d41 Update fv files (#162)
* Files updated for FV function documentation.

* Further FV changes
2024-12-07 12:25:57 +01:00
Nicolás Hatcher
726fc1399d UPDATE: Adds FORMULATEXT for Steve 2024-11-27 22:28:07 +01:00
Nicolás Hatcher
8243e231ab UPDATE: Add placeholders for all functions 2024-11-24 23:08:52 +01:00
Bruno Carvalhal
3c49f9a606 Add error cases 2024-11-17 16:49:41 +01:00
Bruno Carvalhal
a4a40c6fd0 Add test workbook for UNICODE 2024-11-17 16:49:41 +01:00
Nicolás Hatcher
d681f63b25 FIX: Test also full rows and columns in IRR function
This means functions like `=IRR(A:A)` or `=IRR(1:1)`
2024-11-17 11:59:10 +01:00
Nicolás Hatcher
49ae2d8915 FIX: Forbid unwrap, expect and panic in the base code 2024-11-17 11:59:10 +01:00
Varun Hegde
2b03b3e3b9 Error Handling of public Set functions (#88)
What are we trying to achieve ?

++ Currently all the major public set functions is panic prone and does not handle and return error. This PR tries to address to all those functions.

What major errors that could happen in these functions ?

++ All the functions which are being made as error safe is being tested against invalid sheet, row and column values, which could given by user

What are the list of functions whose return type has been altered ?

**base/src/model.rs**
1. update_cell_with_text
2. update_cell_with_bool
3. update_cell_with_number
4. set_user_input
5. get_cell_style_index
6. get_style_for_cell
7. set_cell_with_string

++> New functions being added

1. set_cell_with_boolean
2. set_cell_with_number

**base/src/styles.rs**

1. get_style_with_quote_prefix
3. get_style_with_format
4. get_style_without_quote_prefix
5. get_style

**base/src/worksheet.rs**

1. update_cell
2. set_cell_style
3. set_cell_with_formula
4. set_cell_with_number
6. set_cell_with_string
8. set_cell_with_boolean
9. set_cell_with_error
10. cell_clear_contents
11. cell_clear_contents_with_style

++> Above is the comprehensive list of all functions being ( most are public, some are private ) altered for better error handling. As a side effect of changing function signature, there are many changes being done to other functions ( mostly adding "?" to enable to error propagation further )
2024-09-14 17:37:31 +02:00
Nicolás Hatcher Andrés
40aa8bebaf UPDATE: Adds load_from_xlsx_bytes (#86)
This is usefull if we are transfering bytes, for instance over the internet
2024-08-24 06:50:31 +02:00
Nicolás Hatcher Andrés
dc23a7f29c UPDATE: Adds web app (#79)
Things missing:

* Browse mode
* Front end tests
* Storybook
2024-08-18 11:44:16 +02:00
Varun Hegde
083548608e Exporting the Merged Cell : Exports the merged cell properly with testcase to verify the scenario (#76)
* adding the functionality of exporting the merged cell with testcase to vreify the above enhancement

* addressing review comments : 1) moving the testing to appropriate folder 2) fixing lint errors 3) fixing the scenario when merge cell count is 0

* addressing 2nd round review comments : cosmetic fixes

* addressing review comments : taking reference instead of cloning
2024-07-21 16:13:58 +02:00
Nicolás Hatcher Andrés
c3a9b006d2 FIX: Export views and showGridLines properly (#72) 2024-05-28 21:52:10 +02:00
Nicolás Hatcher Andrés
b37397acb8 UPDATE: Adds ability to show/hide grid lines (#71) 2024-05-26 21:28:00 +02:00
Nicolás Hatcher Andrés
49c3b14bf0 UPDATE: Adds get/set views to the user model API (#69) 2024-05-20 17:51:09 +02:00
Nicolás Hatcher Andrés
f752c90058 UPDATE: Parses selected row/column/range and selected sheet (#67)
* FIX: Update to Rust 1.78.0

* UPDATE: Parses selected row/column/range and selected sheet
2024-05-09 11:46:26 +02:00
Nicolás Hatcher Andrés
49ef846ebd FIX: small diverse fixes (#35) 2024-04-14 21:50:14 +02:00
Nicolás Hatcher Andrés
196e074ef5 UPDATE: Serialize/Deserialize with bitcode (#31)
* UPDATE: Serialize/Deserialize with bitcode

Fixes #12
2024-04-11 23:45:00 +02:00
Nicolás Hatcher Andrés
d445553d85 UPDATE: Adds 'user model' API (#27)
* bump version for documentation
* Fixes wrong doc comment
* renames old APIs to be consistent
2024-04-03 22:41:15 +02:00