Compare commits
1 Commits
feature/ni
...
feature/ni
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce3f0f33c2 |
@@ -2,7 +2,7 @@
|
|||||||
name = "ironcalc_base"
|
name = "ironcalc_base"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
authors = ["Nicolás Hatcher <nicolas@theuniverse.today>"]
|
authors = ["Nicolás Hatcher <nicolas@theuniverse.today>"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
homepage = "https://www.ironcalc.com"
|
homepage = "https://www.ironcalc.com"
|
||||||
repository = "https://github.com/ironcalc/ironcalc/"
|
repository = "https://github.com/ironcalc/ironcalc/"
|
||||||
description = "Open source spreadsheet engine"
|
description = "Open source spreadsheet engine"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use ironcalc_base::{types::CellType, Model};
|
use ironcalc_base::{Model, types::CellType};
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut model = Model::new_empty("formulas-and-errors", "en", "UTC")?;
|
let mut model = Model::new_empty("formulas-and-errors", "en", "UTC")?;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use ironcalc_base::{cell::CellValue, Model};
|
use ironcalc_base::{Model, cell::CellValue};
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut model = Model::new_empty("hello-world", "en", "UTC")?;
|
let mut model = Model::new_empty("hello-world", "en", "UTC")?;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use crate::{
|
|||||||
expressions::{
|
expressions::{
|
||||||
parser::{
|
parser::{
|
||||||
move_formula::ref_is_in_area,
|
move_formula::ref_is_in_area,
|
||||||
stringify::{to_string, to_string_displaced, DisplaceData},
|
stringify::{DisplaceData, to_string, to_string_displaced},
|
||||||
walk::forward_references,
|
walk::forward_references,
|
||||||
},
|
},
|
||||||
types::{Area, CellReferenceIndex, CellReferenceRC},
|
types::{Area, CellReferenceIndex, CellReferenceRC},
|
||||||
|
|||||||
@@ -149,14 +149,16 @@ impl Lexer {
|
|||||||
Ok(n) => n,
|
Ok(n) => n,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return Err(self
|
return Err(self
|
||||||
.set_error(&format!("Failed parsing row {}", row_left), position))
|
.set_error(&format!("Failed parsing row {}", row_left), position));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let row_right = match row_right.parse::<i32>() {
|
let row_right = match row_right.parse::<i32>() {
|
||||||
Ok(n) => n,
|
Ok(n) => n,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return Err(self
|
return Err(self.set_error(
|
||||||
.set_error(&format!("Failed parsing row {}", row_right), position))
|
&format!("Failed parsing row {}", row_right),
|
||||||
|
position,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if row_left > LAST_ROW {
|
if row_left > LAST_ROW {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use super::{
|
use super::{
|
||||||
stringify::{stringify_reference, DisplaceData},
|
|
||||||
Node, Reference,
|
Node, Reference,
|
||||||
|
stringify::{DisplaceData, stringify_reference},
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
constants::{LAST_COLUMN, LAST_ROW},
|
constants::{LAST_COLUMN, LAST_ROW},
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
use crate::expressions::lexer::LexerMode;
|
use crate::expressions::lexer::LexerMode;
|
||||||
use crate::expressions::parser::stringify::{
|
use crate::expressions::parser::stringify::{
|
||||||
to_rc_format, to_string, to_string_displaced, DisplaceData,
|
DisplaceData, to_rc_format, to_string, to_string_displaced,
|
||||||
};
|
};
|
||||||
use crate::expressions::parser::{Node, Parser};
|
use crate::expressions::parser::{Node, Parser};
|
||||||
use crate::expressions::types::CellReferenceRC;
|
use crate::expressions::types::CellReferenceRC;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::expressions::parser::stringify::to_string;
|
|
||||||
use crate::expressions::parser::Parser;
|
use crate::expressions::parser::Parser;
|
||||||
|
use crate::expressions::parser::stringify::to_string;
|
||||||
use crate::expressions::types::CellReferenceRC;
|
use crate::expressions::types::CellReferenceRC;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::expressions::parser::move_formula::{move_formula, MoveContext};
|
|
||||||
use crate::expressions::parser::Parser;
|
use crate::expressions::parser::Parser;
|
||||||
|
use crate::expressions::parser::move_formula::{MoveContext, move_formula};
|
||||||
use crate::expressions::types::{Area, CellReferenceRC};
|
use crate::expressions::types::{Area, CellReferenceRC};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
use crate::expressions::lexer::LexerMode;
|
use crate::expressions::lexer::LexerMode;
|
||||||
|
|
||||||
use crate::expressions::parser::stringify::{to_rc_format, to_string};
|
|
||||||
use crate::expressions::parser::Parser;
|
use crate::expressions::parser::Parser;
|
||||||
|
use crate::expressions::parser::stringify::{to_rc_format, to_string};
|
||||||
use crate::expressions::types::CellReferenceRC;
|
use crate::expressions::types::CellReferenceRC;
|
||||||
|
|
||||||
struct Formula<'a> {
|
struct Formula<'a> {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::expressions::parser::stringify::to_string;
|
|
||||||
use crate::expressions::parser::Parser;
|
use crate::expressions::parser::Parser;
|
||||||
|
use crate::expressions::parser::stringify::to_string;
|
||||||
use crate::expressions::types::CellReferenceRC;
|
use crate::expressions::types::CellReferenceRC;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use super::{move_formula::ref_is_in_area, Node};
|
use super::{Node, move_formula::ref_is_in_area};
|
||||||
|
|
||||||
use crate::expressions::types::{Area, CellReferenceIndex};
|
use crate::expressions::types::{Area, CellReferenceIndex};
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ pub fn format_number(value_original: f64, format: &str, locale: &Locale) -> Form
|
|||||||
text: "#VALUE!".to_owned(),
|
text: "#VALUE!".to_owned(),
|
||||||
color: None,
|
color: None,
|
||||||
error: Some(e),
|
error: Some(e),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for token in tokens {
|
for token in tokens {
|
||||||
@@ -391,11 +391,7 @@ pub fn format_number(value_original: f64, format: &str, locale: &Locale) -> Form
|
|||||||
if l_exp <= p.exponent_digit_count {
|
if l_exp <= p.exponent_digit_count {
|
||||||
if !(number_index < 0 && digit.kind == '#') {
|
if !(number_index < 0 && digit.kind == '#') {
|
||||||
let c = if number_index < 0 {
|
let c = if number_index < 0 {
|
||||||
if digit.kind == '?' {
|
if digit.kind == '?' { ' ' } else { '0' }
|
||||||
' '
|
|
||||||
} else {
|
|
||||||
'0'
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
exponent_part[number_index as usize]
|
exponent_part[number_index as usize]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
formatter::format::format_number,
|
formatter::format::format_number,
|
||||||
locale::{get_locale, Locale},
|
locale::{Locale, get_locale},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn get_default_locale() -> &'static Locale {
|
fn get_default_locale() -> &'static Locale {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ impl Model {
|
|||||||
error: Error::NUM,
|
error: Error::NUM,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: "Out of range parameters for date".to_string(),
|
message: "Out of range parameters for date".to_string(),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let day = date.day() as f64;
|
let day = date.day() as f64;
|
||||||
@@ -54,7 +54,7 @@ impl Model {
|
|||||||
error: Error::NUM,
|
error: Error::NUM,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: "Out of range parameters for date".to_string(),
|
message: "Out of range parameters for date".to_string(),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let month = date.month() as f64;
|
let month = date.month() as f64;
|
||||||
@@ -87,7 +87,7 @@ impl Model {
|
|||||||
error: Error::NUM,
|
error: Error::NUM,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: "Out of range parameters for date".to_string(),
|
message: "Out of range parameters for date".to_string(),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if serial_number > MAXIMUM_DATE_SERIAL_NUMBER as i64 {
|
if serial_number > MAXIMUM_DATE_SERIAL_NUMBER as i64 {
|
||||||
@@ -192,7 +192,7 @@ impl Model {
|
|||||||
error: Error::NUM,
|
error: Error::NUM,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: "Out of range parameters for date".to_string(),
|
message: "Out of range parameters for date".to_string(),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let year = date.year() as f64;
|
let year = date.year() as f64;
|
||||||
@@ -216,7 +216,7 @@ impl Model {
|
|||||||
error: Error::NUM,
|
error: Error::NUM,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: "Out of range parameters for date".to_string(),
|
message: "Out of range parameters for date".to_string(),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ impl Model {
|
|||||||
error: Error::ERROR,
|
error: Error::ERROR,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: "Invalid date".to_string(),
|
message: "Invalid date".to_string(),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// 693_594 is computed as:
|
// 693_594 is computed as:
|
||||||
@@ -296,7 +296,7 @@ impl Model {
|
|||||||
error: Error::ERROR,
|
error: Error::ERROR,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: "Invalid date".to_string(),
|
message: "Invalid date".to_string(),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// 693_594 is computed as:
|
// 693_594 is computed as:
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
use std::f64::consts::FRAC_2_PI;
|
use std::f64::consts::FRAC_2_PI;
|
||||||
|
|
||||||
use super::bessel_util::{high_word, split_words, FRAC_2_SQRT_PI, HUGE};
|
use super::bessel_util::{FRAC_2_SQRT_PI, HUGE, high_word, split_words};
|
||||||
|
|
||||||
// R0/S0 on [0, 2.00]
|
// R0/S0 on [0, 2.00]
|
||||||
const R02: f64 = 1.562_499_999_999_999_5e-2; // 0x3F8FFFFF, 0xFFFFFFFD
|
const R02: f64 = 1.562_499_999_999_999_5e-2; // 0x3F8FFFFF, 0xFFFFFFFD
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
use std::f64::consts::FRAC_2_PI;
|
use std::f64::consts::FRAC_2_PI;
|
||||||
|
|
||||||
use super::bessel_util::{high_word, split_words, FRAC_2_SQRT_PI, HUGE};
|
use super::bessel_util::{FRAC_2_SQRT_PI, HUGE, high_word, split_words};
|
||||||
|
|
||||||
// R0/S0 on [0,2]
|
// R0/S0 on [0,2]
|
||||||
const R00: f64 = -6.25e-2; // 0xBFB00000, 0x00000000
|
const R00: f64 = -6.25e-2; // 0xBFB00000, 0x00000000
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
use super::{
|
use super::{
|
||||||
bessel_j0_y0::{j0, y0},
|
bessel_j0_y0::{j0, y0},
|
||||||
bessel_j1_y1::{j1, y1},
|
bessel_j1_y1::{j1, y1},
|
||||||
bessel_util::{split_words, FRAC_2_SQRT_PI},
|
bessel_util::{FRAC_2_SQRT_PI, split_words},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Special cases are:
|
// Special cases are:
|
||||||
@@ -232,11 +232,7 @@ pub(crate) fn jn(n: i32, x: f64) -> f64 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if sign == 1 {
|
if sign == 1 { -b } else { b }
|
||||||
-b
|
|
||||||
} else {
|
|
||||||
b
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Yn returns the order-n Bessel function of the second kind.
|
// Yn returns the order-n Bessel function of the second kind.
|
||||||
@@ -321,9 +317,5 @@ pub(crate) fn yn(n: i32, x: f64) -> f64 {
|
|||||||
}
|
}
|
||||||
b
|
b
|
||||||
};
|
};
|
||||||
if sign > 0 {
|
if sign > 0 { b } else { -b }
|
||||||
b
|
|
||||||
} else {
|
|
||||||
-b
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,9 +45,5 @@ pub(crate) fn erf(x: f64) -> f64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let res = t * f64::exp(-x_abs * x_abs + 0.5 * (cof[0] + ty * d) - dd);
|
let res = t * f64::exp(-x_abs * x_abs + 0.5 * (cof[0] + ty * d) - dd);
|
||||||
if x < 0.0 {
|
if x < 0.0 { res - 1.0 } else { 1.0 - res }
|
||||||
res - 1.0
|
|
||||||
} else {
|
|
||||||
1.0 - res
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -698,7 +698,7 @@ impl Model {
|
|||||||
error: error.0,
|
error: error.0,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: error.1,
|
message: error.1,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
CalcResult::Number(ipmt)
|
CalcResult::Number(ipmt)
|
||||||
@@ -762,7 +762,7 @@ impl Model {
|
|||||||
error: error.0,
|
error: error.0,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: error.1,
|
message: error.1,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
CalcResult::Number(ppmt)
|
CalcResult::Number(ppmt)
|
||||||
@@ -1075,7 +1075,7 @@ impl Model {
|
|||||||
error,
|
error,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message,
|
message,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1096,7 +1096,7 @@ impl Model {
|
|||||||
error,
|
error,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message,
|
message,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1634,7 +1634,7 @@ impl Model {
|
|||||||
error: error.0,
|
error: error.0,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: error.1,
|
message: error.1,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1702,7 +1702,7 @@ impl Model {
|
|||||||
error: error.0,
|
error: error.0,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: error.1,
|
message: error.1,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1750,11 +1750,7 @@ impl Model {
|
|||||||
rate = 1.0
|
rate = 1.0
|
||||||
};
|
};
|
||||||
let value = if rate == 1.0 {
|
let value = if rate == 1.0 {
|
||||||
if period == 1.0 {
|
if period == 1.0 { cost } else { 0.0 }
|
||||||
cost
|
|
||||||
} else {
|
|
||||||
0.0
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
cost * (1.0 - rate).powf(period - 1.0)
|
cost * (1.0 - rate).powf(period - 1.0)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -257,10 +257,10 @@ impl Model {
|
|||||||
{
|
{
|
||||||
match defined_name {
|
match defined_name {
|
||||||
ParsedDefinedName::CellReference(reference) => {
|
ParsedDefinedName::CellReference(reference) => {
|
||||||
return CalcResult::Number(reference.sheet as f64 + 1.0)
|
return CalcResult::Number(reference.sheet as f64 + 1.0);
|
||||||
}
|
}
|
||||||
ParsedDefinedName::RangeReference(range) => {
|
ParsedDefinedName::RangeReference(range) => {
|
||||||
return CalcResult::Number(range.left.sheet as f64 + 1.0)
|
return CalcResult::Number(range.left.sheet as f64 + 1.0);
|
||||||
}
|
}
|
||||||
ParsedDefinedName::InvalidDefinedNameFormula => {
|
ParsedDefinedName::InvalidDefinedNameFormula => {
|
||||||
return CalcResult::Error {
|
return CalcResult::Error {
|
||||||
@@ -296,7 +296,7 @@ impl Model {
|
|||||||
error: Error::NAME,
|
error: Error::NAME,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: format!("Name not found: {name}"),
|
message: format!("Name not found: {name}"),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
arg => {
|
arg => {
|
||||||
// Now it should be the name of a sheet
|
// Now it should be the name of a sheet
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ impl Model {
|
|||||||
Error::ERROR,
|
Error::ERROR,
|
||||||
cell,
|
cell,
|
||||||
format!("Invalid worksheet index: '{}'", first_range.left.sheet),
|
format!("Invalid worksheet index: '{}'", first_range.left.sheet),
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let max_row = dimension.max_row;
|
let max_row = dimension.max_row;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
calc_result::CalcResult,
|
calc_result::CalcResult,
|
||||||
expressions::{
|
expressions::{
|
||||||
parser::{parse_range, Node},
|
parser::{Node, parse_range},
|
||||||
token::Error,
|
token::Error,
|
||||||
types::CellReferenceIndex,
|
types::CellReferenceIndex,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
text_util::{substitute, text_after, text_before, Case},
|
text_util::{Case, substitute, text_after, text_before},
|
||||||
util::from_wildcard_to_regex,
|
util::from_wildcard_to_regex,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -368,7 +368,7 @@ impl Model {
|
|||||||
error: Error::VALUE,
|
error: Error::VALUE,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: "Empty cell".to_string(),
|
message: "Empty cell".to_string(),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -629,7 +629,7 @@ impl Model {
|
|||||||
error: Error::VALUE,
|
error: Error::VALUE,
|
||||||
origin: cell,
|
origin: cell,
|
||||||
message: "Expecting number".to_string(),
|
message: "Expecting number".to_string(),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
error @ CalcResult::Error { .. } => return error,
|
error @ CalcResult::Error { .. } => return error,
|
||||||
CalcResult::Range { .. } => {
|
CalcResult::Range { .. } => {
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ mod test;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod mock_time;
|
pub mod mock_time;
|
||||||
|
|
||||||
pub use model::get_milliseconds_since_epoch;
|
|
||||||
pub use model::Model;
|
pub use model::Model;
|
||||||
|
pub use model::get_milliseconds_since_epoch;
|
||||||
pub use user_model::BorderArea;
|
pub use user_model::BorderArea;
|
||||||
pub use user_model::ClipboardData;
|
pub use user_model::ClipboardData;
|
||||||
pub use user_model::UserModel;
|
pub use user_model::UserModel;
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ use crate::{
|
|||||||
expressions::{
|
expressions::{
|
||||||
lexer::LexerMode,
|
lexer::LexerMode,
|
||||||
parser::{
|
parser::{
|
||||||
move_formula::{move_formula, MoveContext},
|
|
||||||
stringify::{rename_defined_name_in_node, to_rc_format, to_string},
|
|
||||||
Node, Parser,
|
Node, Parser,
|
||||||
|
move_formula::{MoveContext, move_formula},
|
||||||
|
stringify::{rename_defined_name_in_node, to_rc_format, to_string},
|
||||||
},
|
},
|
||||||
token::{get_error_by_name, Error, OpCompare, OpProduct, OpSum, OpUnary},
|
token::{Error, OpCompare, OpProduct, OpSum, OpUnary, get_error_by_name},
|
||||||
types::*,
|
types::*,
|
||||||
utils::{self, is_valid_column_number, is_valid_identifier, is_valid_row},
|
utils::{self, is_valid_column_number, is_valid_identifier, is_valid_row},
|
||||||
},
|
},
|
||||||
@@ -24,8 +24,8 @@ use crate::{
|
|||||||
},
|
},
|
||||||
functions::util::compare_values,
|
functions::util::compare_values,
|
||||||
implicit_intersection::implicit_intersection,
|
implicit_intersection::implicit_intersection,
|
||||||
language::{get_language, Language},
|
language::{Language, get_language},
|
||||||
locale::{get_locale, Currency, Locale},
|
locale::{Currency, Locale, get_locale},
|
||||||
types::*,
|
types::*,
|
||||||
utils as common,
|
utils as common,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ use crate::{
|
|||||||
expressions::{
|
expressions::{
|
||||||
lexer::LexerMode,
|
lexer::LexerMode,
|
||||||
parser::{
|
parser::{
|
||||||
stringify::{rename_sheet_in_node, to_rc_format},
|
|
||||||
Parser,
|
Parser,
|
||||||
|
stringify::{rename_sheet_in_node, to_rc_format},
|
||||||
},
|
},
|
||||||
types::CellReferenceRC,
|
types::CellReferenceRC,
|
||||||
},
|
},
|
||||||
language::get_language,
|
language::get_language,
|
||||||
locale::get_locale,
|
locale::get_locale,
|
||||||
model::{get_milliseconds_since_epoch, Model, ParsedDefinedName},
|
model::{Model, ParsedDefinedName, get_milliseconds_since_epoch},
|
||||||
types::{
|
types::{
|
||||||
Metadata, SheetState, Workbook, WorkbookSettings, WorkbookView, Worksheet, WorksheetView,
|
Metadata, SheetState, Workbook, WorkbookSettings, WorkbookView, Worksheet, WorksheetView,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ pub fn format_number(value: f64, format_code: &str, locale: &str) -> Formatted {
|
|||||||
text: "#ERROR!".to_owned(),
|
text: "#ERROR!".to_owned(),
|
||||||
color: None,
|
color: None,
|
||||||
error: Some("Invalid locale".to_string()),
|
error: Some("Invalid locale".to_string()),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
formatter::format::format_number(value, format_code, locale)
|
formatter::format::format_number(value, format_code, locale)
|
||||||
|
|||||||
@@ -206,9 +206,11 @@ fn test_delete_column_width() {
|
|||||||
let (sheet, column) = (0, 5);
|
let (sheet, column) = (0, 5);
|
||||||
let normal_width = model.get_column_width(sheet, column).unwrap();
|
let normal_width = model.get_column_width(sheet, column).unwrap();
|
||||||
// Set the width of one column to 5 times the normal width
|
// Set the width of one column to 5 times the normal width
|
||||||
assert!(model
|
assert!(
|
||||||
|
model
|
||||||
.set_column_width(sheet, column, normal_width * 5.0)
|
.set_column_width(sheet, column, normal_width * 5.0)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
|
);
|
||||||
|
|
||||||
// delete it
|
// delete it
|
||||||
assert!(model.delete_columns(sheet, column, 1).is_ok());
|
assert!(model.delete_columns(sheet, column, 1).is_ok());
|
||||||
|
|||||||
@@ -179,7 +179,8 @@ fn test_move_formula_rectangle() {
|
|||||||
width: 2,
|
width: 2,
|
||||||
height: 20,
|
height: 20,
|
||||||
};
|
};
|
||||||
assert!(model
|
assert!(
|
||||||
|
model
|
||||||
.move_cell_value_to_area(
|
.move_cell_value_to_area(
|
||||||
value,
|
value,
|
||||||
&CellReferenceIndex {
|
&CellReferenceIndex {
|
||||||
@@ -190,8 +191,10 @@ fn test_move_formula_rectangle() {
|
|||||||
target,
|
target,
|
||||||
area
|
area
|
||||||
)
|
)
|
||||||
.is_err());
|
.is_err()
|
||||||
assert!(model
|
);
|
||||||
|
assert!(
|
||||||
|
model
|
||||||
.move_cell_value_to_area(
|
.move_cell_value_to_area(
|
||||||
value,
|
value,
|
||||||
&CellReferenceIndex {
|
&CellReferenceIndex {
|
||||||
@@ -202,8 +205,10 @@ fn test_move_formula_rectangle() {
|
|||||||
target,
|
target,
|
||||||
area
|
area
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
assert!(model
|
);
|
||||||
|
assert!(
|
||||||
|
model
|
||||||
.move_cell_value_to_area(
|
.move_cell_value_to_area(
|
||||||
value,
|
value,
|
||||||
&CellReferenceIndex {
|
&CellReferenceIndex {
|
||||||
@@ -214,8 +219,10 @@ fn test_move_formula_rectangle() {
|
|||||||
target,
|
target,
|
||||||
area
|
area
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
assert!(model
|
);
|
||||||
|
assert!(
|
||||||
|
model
|
||||||
.move_cell_value_to_area(
|
.move_cell_value_to_area(
|
||||||
value,
|
value,
|
||||||
&CellReferenceIndex {
|
&CellReferenceIndex {
|
||||||
@@ -226,5 +233,6 @@ fn test_move_formula_rectangle() {
|
|||||||
target,
|
target,
|
||||||
area
|
area
|
||||||
)
|
)
|
||||||
.is_err());
|
.is_err()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{constants::DEFAULT_COLUMN_WIDTH, UserModel};
|
use crate::{UserModel, constants::DEFAULT_COLUMN_WIDTH};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn add_undo_redo() {
|
fn add_undo_redo() {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
|
use crate::UserModel;
|
||||||
use crate::constants::{LAST_COLUMN, LAST_ROW};
|
use crate::constants::{LAST_COLUMN, LAST_ROW};
|
||||||
use crate::expressions::types::Area;
|
use crate::expressions::types::Area;
|
||||||
use crate::test::util::new_empty_model;
|
use crate::test::util::new_empty_model;
|
||||||
use crate::UserModel;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic_tests() {
|
fn basic_tests() {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
|
use crate::UserModel;
|
||||||
use crate::constants::{LAST_COLUMN, LAST_ROW};
|
use crate::constants::{LAST_COLUMN, LAST_ROW};
|
||||||
use crate::expressions::types::Area;
|
use crate::expressions::types::Area;
|
||||||
use crate::test::util::new_empty_model;
|
use crate::test::util::new_empty_model;
|
||||||
use crate::UserModel;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic_tests() {
|
fn basic_tests() {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
BorderArea, UserModel,
|
||||||
constants::{LAST_COLUMN, LAST_ROW},
|
constants::{LAST_COLUMN, LAST_ROW},
|
||||||
expressions::{types::Area, utils::number_to_column},
|
expressions::{types::Area, utils::number_to_column},
|
||||||
types::{Border, BorderItem, BorderStyle},
|
types::{Border, BorderItem, BorderStyle},
|
||||||
BorderArea, UserModel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// checks there are no borders in the sheet
|
// checks there are no borders in the sheet
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{expressions::types::Area, UserModel};
|
use crate::{UserModel, expressions::types::Area};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic() {
|
fn basic() {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
|
use crate::UserModel;
|
||||||
use crate::constants::{DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT, LAST_COLUMN, LAST_ROW};
|
use crate::constants::{DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT, LAST_COLUMN, LAST_ROW};
|
||||||
use crate::expressions::types::Area;
|
use crate::expressions::types::Area;
|
||||||
use crate::UserModel;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn column_width() {
|
fn column_width() {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
UserModel,
|
||||||
constants::{DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT, LAST_COLUMN, LAST_ROW},
|
constants::{DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT, LAST_COLUMN, LAST_ROW},
|
||||||
expressions::types::Area,
|
expressions::types::Area,
|
||||||
UserModel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
UserModel,
|
||||||
constants::{DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT},
|
constants::{DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT},
|
||||||
test::util::new_empty_model,
|
test::util::new_empty_model,
|
||||||
UserModel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -157,7 +157,9 @@ fn new_sheet() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn wrong_diffs_handled() {
|
fn wrong_diffs_handled() {
|
||||||
let mut model = UserModel::from_model(new_empty_model());
|
let mut model = UserModel::from_model(new_empty_model());
|
||||||
assert!(model
|
assert!(
|
||||||
|
model
|
||||||
.apply_external_diffs("Hello world".as_bytes())
|
.apply_external_diffs("Hello world".as_bytes())
|
||||||
.is_err());
|
.is_err()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
|
use crate::UserModel;
|
||||||
use crate::constants::{LAST_COLUMN, LAST_ROW};
|
use crate::constants::{LAST_COLUMN, LAST_ROW};
|
||||||
use crate::test::util::new_empty_model;
|
use crate::test::util::new_empty_model;
|
||||||
use crate::types::CellType;
|
use crate::types::CellType;
|
||||||
use crate::UserModel;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn set_user_input_errors() {
|
fn set_user_input_errors() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::test::util::new_empty_model;
|
|
||||||
use crate::UserModel;
|
use crate::UserModel;
|
||||||
|
use crate::test::util::new_empty_model;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic_tests() {
|
fn basic_tests() {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
UserModel,
|
||||||
constants::{
|
constants::{
|
||||||
DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT, DEFAULT_WINDOW_HEIGHT, DEFAULT_WINDOW_WIDTH,
|
DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT, DEFAULT_WINDOW_HEIGHT, DEFAULT_WINDOW_WIDTH,
|
||||||
LAST_COLUMN,
|
LAST_COLUMN,
|
||||||
},
|
},
|
||||||
test::util::new_empty_model,
|
test::util::new_empty_model,
|
||||||
UserModel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
UserModel,
|
||||||
constants::{DEFAULT_COLUMN_WIDTH, DEFAULT_WINDOW_WIDTH},
|
constants::{DEFAULT_COLUMN_WIDTH, DEFAULT_WINDOW_WIDTH},
|
||||||
test::util::new_empty_model,
|
test::util::new_empty_model,
|
||||||
UserModel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
UserModel,
|
||||||
constants::{DEFAULT_COLUMN_WIDTH, DEFAULT_WINDOW_WIDTH, LAST_COLUMN},
|
constants::{DEFAULT_COLUMN_WIDTH, DEFAULT_WINDOW_WIDTH, LAST_COLUMN},
|
||||||
test::util::new_empty_model,
|
test::util::new_empty_model,
|
||||||
UserModel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
|
use crate::UserModel;
|
||||||
use crate::test::util::new_empty_model;
|
use crate::test::util::new_empty_model;
|
||||||
use crate::types::Fill;
|
use crate::types::Fill;
|
||||||
use crate::UserModel;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn simple_pasting() {
|
fn simple_pasting() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{expressions::types::Area, UserModel};
|
use crate::{UserModel, expressions::types::Area};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn csv_paste() {
|
fn csv_paste() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
constants::LAST_ROW, expressions::types::Area, test::util::new_empty_model, UserModel,
|
UserModel, constants::LAST_ROW, expressions::types::Area, test::util::new_empty_model,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
UserModel,
|
||||||
constants::{DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT, LAST_COLUMN},
|
constants::{DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT, LAST_COLUMN},
|
||||||
test::util::new_empty_model,
|
test::util::new_empty_model,
|
||||||
UserModel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::test::util::new_empty_model;
|
|
||||||
use crate::UserModel;
|
use crate::UserModel;
|
||||||
|
use crate::test::util::new_empty_model;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic_tests() {
|
fn basic_tests() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::test::util::new_empty_model;
|
|
||||||
use crate::UserModel;
|
use crate::UserModel;
|
||||||
|
use crate::test::util::new_empty_model;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic_undo_redo() {
|
fn basic_undo_redo() {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
UserModel,
|
||||||
expressions::types::Area,
|
expressions::types::Area,
|
||||||
types::{Alignment, HorizontalAlignment, VerticalAlignment},
|
types::{Alignment, HorizontalAlignment, VerticalAlignment},
|
||||||
UserModel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{test::util::new_empty_model, UserModel};
|
use crate::{UserModel, test::util::new_empty_model};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic() {
|
fn basic() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{test::util::new_empty_model, UserModel};
|
use crate::{UserModel, test::util::new_empty_model};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn simple_undo_redo() {
|
fn simple_undo_redo() {
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
UserModel,
|
||||||
constants::{LAST_COLUMN, LAST_ROW},
|
constants::{LAST_COLUMN, LAST_ROW},
|
||||||
test::util::new_empty_model,
|
test::util::new_empty_model,
|
||||||
user_model::SelectedView,
|
user_model::SelectedView,
|
||||||
UserModel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
UserModel,
|
||||||
constants::{DEFAULT_ROW_HEIGHT, DEFAULT_WINDOW_HEIGHT, DEFAULT_WINDOW_WIDTH},
|
constants::{DEFAULT_ROW_HEIGHT, DEFAULT_WINDOW_HEIGHT, DEFAULT_WINDOW_WIDTH},
|
||||||
test::util::new_empty_model,
|
test::util::new_empty_model,
|
||||||
UserModel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use crate::{expressions::types::Area, types::Border, BorderArea, UserModel};
|
use crate::{BorderArea, UserModel, expressions::types::Area, types::Border};
|
||||||
|
|
||||||
impl UserModel {
|
impl UserModel {
|
||||||
pub fn _set_cell_border(&mut self, cell: &str, color: &str) {
|
pub fn _set_cell_border(&mut self, cell: &str, color: &str) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
border_utils::is_max_border, common::BorderType, history::Diff, BorderArea, UserModel,
|
BorderArea, UserModel, border_utils::is_max_border, common::BorderType, history::Diff,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl UserModel {
|
impl UserModel {
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ mod tests {
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::language::get_language;
|
use crate::language::get_language;
|
||||||
use crate::locale::{get_locale, Locale};
|
use crate::locale::{Locale, get_locale};
|
||||||
|
|
||||||
fn get_test_locale() -> &'static Locale {
|
fn get_test_locale() -> &'static Locale {
|
||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
name = "ironcalc_nodejs"
|
name = "ironcalc_nodejs"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
tab_spaces = 2
|
tab_spaces = 2
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#![deny(clippy::all)]
|
#![deny(clippy::all)]
|
||||||
|
|
||||||
use napi::{self, bindgen_prelude::*, JsUnknown, Result};
|
use napi::{self, JsUnknown, Result, bindgen_prelude::*};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use ironcalc::{
|
use ironcalc::{
|
||||||
base::{
|
base::{
|
||||||
types::{CellType, Style},
|
|
||||||
Model as BaseModel,
|
Model as BaseModel,
|
||||||
|
types::{CellType, Style},
|
||||||
},
|
},
|
||||||
error::XlsxError,
|
error::XlsxError,
|
||||||
export::{save_to_icalc, save_to_xlsx},
|
export::{save_to_icalc, save_to_xlsx},
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use napi::{self, bindgen_prelude::*, JsUnknown, Result};
|
use napi::{self, JsUnknown, Result, bindgen_prelude::*};
|
||||||
|
|
||||||
use ironcalc::base::{
|
use ironcalc::base::{
|
||||||
|
BorderArea, ClipboardData, UserModel as BaseModel,
|
||||||
expressions::types::Area,
|
expressions::types::Area,
|
||||||
types::{CellType, Style},
|
types::{CellType, Style},
|
||||||
BorderArea, ClipboardData, UserModel as BaseModel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "pyroncalc"
|
name = "pyroncalc"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ use pyo3::exceptions::PyException;
|
|||||||
use pyo3::{create_exception, prelude::*, wrap_pyfunction};
|
use pyo3::{create_exception, prelude::*, wrap_pyfunction};
|
||||||
|
|
||||||
use types::{PySheetProperty, PyStyle};
|
use types::{PySheetProperty, PyStyle};
|
||||||
use xlsx::base::types::Style;
|
|
||||||
use xlsx::base::Model;
|
use xlsx::base::Model;
|
||||||
|
use xlsx::base::types::Style;
|
||||||
|
|
||||||
use xlsx::export::{save_to_icalc, save_to_xlsx};
|
use xlsx::export::{save_to_icalc, save_to_xlsx};
|
||||||
use xlsx::import;
|
use xlsx::import;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ authors = ["Nicolas Hatcher <nicolas@theuniverse.today>"]
|
|||||||
description = "IronCalc Web bindings"
|
description = "IronCalc Web bindings"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
repository = "https://github.com/ironcalc/ironcalc"
|
repository = "https://github.com/ironcalc/ironcalc"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use wasm_bindgen::{
|
use wasm_bindgen::{
|
||||||
prelude::{wasm_bindgen, JsError},
|
|
||||||
JsValue,
|
JsValue,
|
||||||
|
prelude::{JsError, wasm_bindgen},
|
||||||
};
|
};
|
||||||
|
|
||||||
use ironcalc_base::{
|
use ironcalc_base::{
|
||||||
|
BorderArea, ClipboardData, UserModel as BaseModel,
|
||||||
expressions::{lexer::util::get_tokens as tokenizer, types::Area, utils::number_to_column},
|
expressions::{lexer::util::get_tokens as tokenizer, types::Area, utils::number_to_column},
|
||||||
types::{CellType, Style},
|
types::{CellType, Style},
|
||||||
BorderArea, ClipboardData, UserModel as BaseModel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fn to_js_error(error: String) -> JsError {
|
fn to_js_error(error: String) -> JsError {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
name = "generate_locale"
|
name = "generate_locale"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Nicolás Hatcher <nicolas@theuniverse.today>"]
|
authors = ["Nicolás Hatcher <nicolas@theuniverse.today>"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ironcalc_server"
|
name = "ironcalc_server"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rocket = "0.5"
|
rocket = "0.5"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
name = "ironcalc"
|
name = "ironcalc"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
authors = ["Nicolás Hatcher <nicolas@theuniverse.today>"]
|
authors = ["Nicolás Hatcher <nicolas@theuniverse.today>"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
homepage = "https://www.ironcalc.com"
|
homepage = "https://www.ironcalc.com"
|
||||||
repository = "https://github.com/ironcalc/ironcalc/"
|
repository = "https://github.com/ironcalc/ironcalc/"
|
||||||
description = "The democratization of spreadsheets"
|
description = "The democratization of spreadsheets"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use ironcalc::{
|
use ironcalc::{
|
||||||
base::{expressions::utils::number_to_column, Model},
|
base::{Model, expressions::utils::number_to_column},
|
||||||
export::save_to_xlsx,
|
export::save_to_xlsx,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use std::path::Path;
|
|||||||
|
|
||||||
use ironcalc_base::cell::CellValue;
|
use ironcalc_base::cell::CellValue;
|
||||||
use ironcalc_base::types::*;
|
use ironcalc_base::types::*;
|
||||||
use ironcalc_base::{expressions::utils::number_to_column, Model};
|
use ironcalc_base::{Model, expressions::utils::number_to_column};
|
||||||
|
|
||||||
use crate::export::save_to_xlsx;
|
use crate::export::save_to_xlsx;
|
||||||
use crate::import::load_from_xlsx;
|
use crate::import::load_from_xlsx;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use chrono::DateTime;
|
use chrono::DateTime;
|
||||||
use ironcalc_base::{
|
use ironcalc_base::{
|
||||||
new_empty::{APPLICATION, APP_VERSION, IRONCALC_USER},
|
new_empty::{APP_VERSION, APPLICATION, IRONCALC_USER},
|
||||||
types::Workbook,
|
types::Workbook,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ pub(crate) fn get_core_xml(workbook: &Workbook, milliseconds: i64) -> Result<Str
|
|||||||
return Err(XlsxError::Xml(format!(
|
return Err(XlsxError::Xml(format!(
|
||||||
"Invalid timestamp: {}",
|
"Invalid timestamp: {}",
|
||||||
milliseconds
|
milliseconds
|
||||||
)))
|
)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let last_modified = dt.format("%Y-%m-%dT%H:%M:%SZ").to_string();
|
let last_modified = dt.format("%Y-%m-%dT%H:%M:%SZ").to_string();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ use std::{
|
|||||||
|
|
||||||
use ironcalc_base::expressions::utils::number_to_column;
|
use ironcalc_base::expressions::utils::number_to_column;
|
||||||
use ironcalc_base::types::Workbook;
|
use ironcalc_base::types::Workbook;
|
||||||
use ironcalc_base::{get_milliseconds_since_epoch, Model};
|
use ironcalc_base::{Model, get_milliseconds_since_epoch};
|
||||||
|
|
||||||
use self::xml_constants::XML_DECLARATION;
|
use self::xml_constants::XML_DECLARATION;
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,12 @@ pub(crate) fn get_shared_strings_xml(model: &Workbook) -> String {
|
|||||||
for shared_string in &model.shared_strings {
|
for shared_string in &model.shared_strings {
|
||||||
shared_strings.push(format!("<si><t>{}</t></si>", escape_xml(shared_string)));
|
shared_strings.push(format!("<si><t>{}</t></si>", escape_xml(shared_string)));
|
||||||
}
|
}
|
||||||
format!("{}\n\
|
format!(
|
||||||
|
"{}\n\
|
||||||
<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"{count}\" uniqueCount=\"{unique_count}\">\
|
<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"{count}\" uniqueCount=\"{unique_count}\">\
|
||||||
{}\
|
{}\
|
||||||
</sst>", XML_DECLARATION, shared_strings.join(""))
|
</sst>",
|
||||||
|
XML_DECLARATION,
|
||||||
|
shared_strings.join("")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,11 +158,13 @@ fn test_named_styles() {
|
|||||||
save_to_xlsx(&model, temp_file_name).unwrap();
|
save_to_xlsx(&model, temp_file_name).unwrap();
|
||||||
|
|
||||||
let model = load_from_xlsx(temp_file_name, "en", "UTC").unwrap();
|
let model = load_from_xlsx(temp_file_name, "en", "UTC").unwrap();
|
||||||
assert!(model
|
assert!(
|
||||||
|
model
|
||||||
.workbook
|
.workbook
|
||||||
.styles
|
.styles
|
||||||
.get_style_index_by_name("bold & italics")
|
.get_style_index_by_name("bold & italics")
|
||||||
.is_ok());
|
.is_ok()
|
||||||
|
);
|
||||||
fs::remove_file(temp_file_name).unwrap();
|
fs::remove_file(temp_file_name).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use itertools::Itertools;
|
|||||||
|
|
||||||
use ironcalc_base::{
|
use ironcalc_base::{
|
||||||
expressions::{
|
expressions::{
|
||||||
parser::{stringify::to_excel_string, Node},
|
parser::{Node, stringify::to_excel_string},
|
||||||
types::CellReferenceRC,
|
types::CellReferenceRC,
|
||||||
utils::number_to_column,
|
utils::number_to_column,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ use std::{
|
|||||||
use roxmltree::Node;
|
use roxmltree::Node;
|
||||||
|
|
||||||
use ironcalc_base::{
|
use ironcalc_base::{
|
||||||
types::{Metadata, Workbook, WorkbookSettings, WorkbookView},
|
|
||||||
Model,
|
Model,
|
||||||
|
types::{Metadata, Workbook, WorkbookSettings, WorkbookView},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::error::XlsxError;
|
use crate::error::XlsxError;
|
||||||
@@ -28,7 +28,7 @@ use metadata::load_metadata;
|
|||||||
use styles::load_styles;
|
use styles::load_styles;
|
||||||
use util::get_attribute;
|
use util::get_attribute;
|
||||||
use workbook::load_workbook;
|
use workbook::load_workbook;
|
||||||
use worksheets::{load_sheets, Relationship};
|
use worksheets::{Relationship, load_sheets};
|
||||||
|
|
||||||
fn load_relationships<R: Read + std::io::Seek>(
|
fn load_relationships<R: Read + std::io::Seek>(
|
||||||
archive: &mut zip::ZipArchive<R>,
|
archive: &mut zip::ZipArchive<R>,
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ use std::{collections::HashMap, io::Read, num::ParseIntError};
|
|||||||
|
|
||||||
use ironcalc_base::{
|
use ironcalc_base::{
|
||||||
expressions::{
|
expressions::{
|
||||||
parser::{stringify::to_rc_format, Parser},
|
parser::{Parser, stringify::to_rc_format},
|
||||||
token::{get_error_by_english_name, Error},
|
token::{Error, get_error_by_english_name},
|
||||||
types::CellReferenceRC,
|
types::CellReferenceRC,
|
||||||
utils::{column_to_number, parse_reference_a1},
|
utils::{column_to_number, parse_reference_a1},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user