mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-18 16:14:57 +00:00
XLSX: NETWORKDAYS.INTL and WORKDAY.INTL are saved without _xlfn. (#3517)
Both are in the file format's own function list, so a file stores them unprefixed; LibreOffice gives #NAME? for the prefixed spelling. They are removed from FUTURE_FUNCTIONS. A file with the prefix still reads (the parser strips it).
This commit is contained in:
1 parent
dea064b857
commit
e4e2c5292a
2 files changed
+15
-4
No files matched your search
@@ -319,6 +319,18 @@ mod tests {
|
||||
assert!(checked > gridcraft_functions::all().len() * 10, "only {checked} formulas parsed");
|
||||
}
|
||||
|
||||
/// NETWORKDAYS.INTL and WORKDAY.INTL are in the file format's own function list: saved without
|
||||
/// `_xlfn.` (LibreOffice gives #NAME? for the prefixed spelling), and the prefixed spelling of a
|
||||
/// file written by an older version still reads (#3517, #2775).
|
||||
#[test]
|
||||
fn intl_day_functions_are_saved_without_the_prefix() {
|
||||
let f = Formula::new("NETWORKDAYS.INTL(DATE(2026,1,5),DATE(2026,1,9),1)+WORKDAY.INTL(DATE(2026,1,5),3,1)");
|
||||
assert_eq!(to_file(&f), "NETWORKDAYS.INTL(DATE(2026,1,5),DATE(2026,1,9),1)+WORKDAY.INTL(DATE(2026,1,5),3,1)");
|
||||
assert_eq!(text_to_file("=WORKDAY.INTL(A1,3,1)"), "WORKDAY.INTL(A1,3,1)");
|
||||
assert_eq!(from_file("_xlfn.NETWORKDAYS.INTL(A1,B1,1)+_xlfn.WORKDAY.INTL(A1,3,1)"), "NETWORKDAYS.INTL(A1,B1,1)+WORKDAY.INTL(A1,3,1)");
|
||||
assert_eq!(from_file("NETWORKDAYS.INTL(A1,B1,1)"), "NETWORKDAYS.INTL(A1,B1,1)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn spill_references() {
|
||||
assert_eq!(to_file(&Formula::new("SUM(Sheet1!$D$1#)+B2#")), "SUM(_xlfn.ANCHORARRAY(Sheet1!$D$1))+_xlfn.ANCHORARRAY(B2)");
|
||||
|
||||
@@ -111,6 +111,7 @@ pub fn paper_id(name: &str) -> Option<u32> {
|
||||
|
||||
/// Functions introduced after Excel 2007 that files store with the `_xlfn.` prefix. Entries with
|
||||
/// `_xlws.` get `_xlfn._xlws.`.
|
||||
/// NETWORKDAYS.INTL and WORKDAY.INTL are in the file format's own function list, so they're saved without `_xlfn.` (#3517).
|
||||
const FUTURE_FUNCTIONS: &[&str] = &[
|
||||
"ACOT",
|
||||
"ACOTH",
|
||||
@@ -207,7 +208,6 @@ const FUTURE_FUNCTIONS: &[&str] = &[
|
||||
"MODE.SNGL",
|
||||
"MUNIT",
|
||||
"NEGBINOM.DIST",
|
||||
"NETWORKDAYS.INTL",
|
||||
"NORM.DIST",
|
||||
"NORM.INV",
|
||||
"NORM.S.DIST",
|
||||
@@ -270,7 +270,6 @@ const FUTURE_FUNCTIONS: &[&str] = &[
|
||||
"VSTACK",
|
||||
"WEBSERVICE",
|
||||
"WEIBULL.DIST",
|
||||
"WORKDAY.INTL",
|
||||
"WRAPCOLS",
|
||||
"WRAPROWS",
|
||||
"XLOOKUP",
|
||||
@@ -358,8 +357,8 @@ mod tests {
|
||||
assert_eq!(file_function_name("stockhistory").as_deref(), Some("_xlfn.STOCKHISTORY"));
|
||||
assert_eq!(file_function_name("TRANSLATE").as_deref(), Some("_xlfn.TRANSLATE"));
|
||||
assert_eq!(file_function_name("DETECTLANGUAGE").as_deref(), Some("_xlfn.DETECTLANGUAGE"));
|
||||
assert_eq!(file_function_name("NETWORKDAYS.INTL").as_deref(), Some("_xlfn.NETWORKDAYS.INTL"));
|
||||
assert_eq!(file_function_name("WORKDAY.INTL").as_deref(), Some("_xlfn.WORKDAY.INTL"));
|
||||
assert_eq!(file_function_name("NETWORKDAYS.INTL"), None);
|
||||
assert_eq!(file_function_name("WORKDAY.INTL"), None);
|
||||
// Excel 16.0 build 20527 saves COPILOT as plain `COPILOT(...)` (it does not know the name yet).
|
||||
assert_eq!(file_function_name("COPILOT"), None);
|
||||
assert_eq!(file_function_name("SUM"), None);
|
||||
|
||||
Reference in new issue
Block a user