excelize_rs/options.rs
1//! Options for opening and reading spreadsheet files.
2//!
3//! Mirrors the Go `Options` struct from `excelize.go`.
4
5use crate::constants::{STREAM_CHUNK_SIZE, UNZIP_SIZE_LIMIT};
6
7/// Culture identifier used when applying language-sensitive number formats.
8pub type CultureName = u8;
9
10/// Unknown / unspecified culture.
11pub const CULTURE_NAME_UNKNOWN: CultureName = 0;
12
13/// Options for opening, reading and saving spreadsheet files.
14#[derive(Debug, Clone)]
15pub struct Options {
16 /// Maximum iterations for iterative calculation.
17 pub max_calc_iterations: u32,
18 /// Plain-text password for encrypted workbooks.
19 pub password: String,
20 /// Return raw cell values without applying number formats.
21 pub raw_cell_value: bool,
22 /// Total unzip size limit in bytes.
23 pub unzip_size_limit: i64,
24 /// Per-XML memory limit before extracting to a temporary file.
25 pub unzip_xml_size_limit: i64,
26 /// Directory for temporary files (empty = system default).
27 pub tmp_dir: String,
28 /// Short date number format pattern.
29 pub short_date_pattern: String,
30 /// Long date number format pattern.
31 pub long_date_pattern: String,
32 /// Long time number format pattern.
33 pub long_time_pattern: String,
34 /// Country code for built-in language number formats.
35 pub culture_info: CultureName,
36}
37
38impl Default for Options {
39 fn default() -> Self {
40 Self {
41 max_calc_iterations: 0,
42 password: String::new(),
43 raw_cell_value: false,
44 unzip_size_limit: UNZIP_SIZE_LIMIT,
45 unzip_xml_size_limit: STREAM_CHUNK_SIZE,
46 tmp_dir: String::new(),
47 short_date_pattern: String::new(),
48 long_date_pattern: String::new(),
49 long_time_pattern: String::new(),
50 culture_info: CULTURE_NAME_UNKNOWN,
51 }
52 }
53}