GithubHelp home page GithubHelp logo

mathnya / umya-spreadsheet Goto Github PK

View Code? Open in Web Editor NEW
259.0 4.0 44.0 10.57 MB

A pure rust library for reading and writing spreadsheet files

License: MIT License

Rust 100.00%
rust spreadsheet excel xlsx

umya-spreadsheet's Introduction

umya-spreadsheet

Result Image

Crates.io Github CI Crates.io GitHub Sponsor

Description

umya-spreadsheet is a library written in pure Rust to read and write xlsx file.

Chatting

The chat will be closed.

(Maybe I didn't set it up right, but it's because I no longer get notifications when new messages come in and I don't notice them anymore.)

Please mention in issues if you have any questions.

Update details

ver 2.0.1

  • Minor bug fixes

Usage

Installation

Add the following code to Cargo.toml

[dependencies]
umya-spreadsheet = "2.0.1"

# WebAssembly support
umya-spreadsheet = { version = "2.0.1", features = ["js"] }

Add the following code to main.rs

extern crate umya_spreadsheet;

Read file

let path = std::path::Path::new("./tests/test_files/aaa.xlsx");
let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap();

Read file (Lazy)

Delays the loading of the worksheet until it is needed.
When loading a file with a large amount of data, response improvement can be expected.

let path = std::path::Path::new("./tests/test_files/aaa.xlsx");
let mut book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap();

New file

let mut book = umya_spreadsheet::new_file();

Write file

let path = std::path::Path::new("./tests/result_files/bbb.xlsx");
let _ = umya_spreadsheet::writer::xlsx::write(&book, path);

Write file with password

let path = std::path::Path::new("./tests/result_files/bbb.xlsx");
let _ = umya_spreadsheet::writer::xlsx::write_with_password(&book, path, "password");
let from_path = std::path::Path::new("./tests/test_files/aaa.xlsx");
let to_path = std::path::Path::new("./tests/result_files/bbb.xlsx");
let _ = umya_spreadsheet::writer::xlsx::set_password(&from_path, &to_path, "password");

Read Value

let mut book = umya_spreadsheet::new_file();
book.get_sheet_by_name("Sheet1").unwrap().get_cell("A1").get_value();
book.get_sheet_by_name("Sheet1").unwrap().get_cell((1, 1)).get_value();
book.get_sheet_by_name("Sheet1").unwrap().get_cell((&1, &1)).get_value();
book.get_sheet_mut(0).unwrap().get_cell((&1, &1)).get_value();

Change Value

let mut book = umya_spreadsheet::new_file();
book.get_sheet_by_name_mut("Sheet1").unwrap().get_cell_mut("A1").set_value("TEST1");
book.get_sheet_mut(0).unwrap().get_cell_mut("A1").set_value("TEST2");

Move Values

let range = "A1:A3";
let row = 10;
let column = 2;
book.get_sheet_by_name_mut("Sheet1").unwrap().move_range(range, &row, &column);

Change Style

let mut book = umya_spreadsheet::new_file();
let mut style = book.get_sheet_by_name_mut("Sheet1").unwrap().get_style_mut("A1");
// fill color on red.
style.set_background_color(umya_spreadsheet::Color::COLOR_RED);

New Chart

let mut book = umya_spreadsheet::new_file();
// Add Chart
let mut from_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default();
from_marker.set_coordinate("C1");
let mut to_marker = umya_spreadsheet::structs::drawing::spreadsheet::MarkerType::default();
to_marker.set_coordinate("D11");
let area_chart_series_list = vec![
    "Sheet1!$A$1:$A$10",
    "Sheet1!$B$1:$B$10",
];
let mut chart = umya_spreadsheet::structs::Chart::default();
chart.new_chart(
    umya_spreadsheet::structs::ChartType::LineChart,
    from_marker,
    to_marker,
    area_chart_series_list,
);
book.get_sheet_by_name_mut("Sheet1").unwrap()
    .add_chart(chart);

Struct

Pass the book as a Spreadsheet to modify it in other functions.

let mut book = umya_spreadsheet::new_file();
let _ = book.new_sheet("Sheet2");
update_excel(&mut book);

fn update_excel(book: &mut Spreadsheet) {
   book.get_sheet_by_name_mut("Sheet2").unwrap().get_cell_mut("A1").set_value("Test"); 
}

See the next chapter for implementation status and more detailed usage.

Support Status

Function detail example
file reader xlsx, xlsm here.
file lazy_reader xlsx, xlsm here.
file writer xlsx, xlsm here.
csv here.
file writer with password xlsx, xlsm here.
worksheet read, new, copy here.
cell value read, edit, formated value. here.
cell style read, edit here.
columns read, edit, auto width here.
rows read, edit
charts read, edit here.
drawings read, edit(Still might be inconvenient.)
images read, edit here.
ole objects read, edit(Still might be inconvenient.)

License

MIT

Contributing

Contributions by way of pull requests are welcome! Please make sure your code uses:

  • cargo fmt for formatting
  • clippy

umya-spreadsheet's People

Contributors

agentjill avatar attila-lin avatar boseongkim32 avatar fabianboesiger avatar ggodlewski avatar hackers267 avatar iancormac84 avatar jimchan3301 avatar jmbrunskill avatar john-dc252 avatar kazuk avatar kygost avatar mathnya avatar matt-duch avatar nikvoid avatar patrickomatic avatar popen2 avatar roloedits avatar samuelmarks avatar tomgroenwoldt avatar ubamrein avatar usagi avatar vonkruel avatar zjhsd2007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

umya-spreadsheet's Issues

Reader panics when trying to read a .xlsx

This is my code:

use umya_spreadsheet::reader;

fn main() {
    let opt = Opt::from_args();
    let in_sheet = reader::xlsx::read(opt.input.as_path()).expect("Didn't find input");
}

And this is the panic:

thread 'main' panicked at 'attempt to subtract with overflow', /home/spyros/.cargo/registry/src/github.com-1ecc6299db9ec823/umya-spreadsheet-0.1.12-beta/src/structs/color.rs:123:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Any idea why this is happening? If you need more info or the StructOpt struct let me know

`Worksheet::last_row()` or similar

Currently, to get the last row number, I'm using:

sheet.get_row_dimensions().len()

Surely there's a nicer API for this? Maybe one already exists and I couldn't find it?

Issues with writing file

After having written around 11k rows, when the time comes to save the file it freezes and the it spams "something else" to the console.
I went through my code and I don't ever print "something else", also I added a print just before umya_spreadsheet::writer::xlsx::write(&out_book, path).expect("Failed to write file to disk");
My line gets printed, then it freezes and then is spams "something else"

Any idea what might be wrong?

[Request] update doc to include example reading image in cell

In the readme, it's mentioned that umya-spreadsheet can read and edit images in cell(albeit still might be inconvenient).
I looked into Image and found get_image_data to return a &Vec<u8>, but didn't know how to write this vec to a valid image file(with the right format).
Could you give an example in the readme?

Thanks in advance.

super slow

when writing data to about 6000 cells, it took about 15min. The cpu usage is very high.

A part of a border settings of a merged cell are lost

Repro

  1. Create a test input.xlsx file using Excel that has:
  • (a) a merged cell
  • (b) a borders of (a)
  1. Read: let book = umya_spreadsheet::reader::xlsx::read(Path::new("input.xlsx")).unwrap()
  2. Write: umya_spreadsheet::writer::xlsx::write(&book, Path::new("output.xlsx")).unwrap()

Screenshots

"input.xlsx"

image

"output.xlsx"

image

Read cell with number format

How may we read a cell's value in it's formatted form?

For example, expected value is: "49,046,881.12" , what is returned is: "49046881.119999997"

let val = book.get_sheet(0)
            .unwrap()
            .get_cell("H2")
            .unwrap()
            .get_value();

Chart example

Thanks for this awesome library!
Could you please add a chart example to the readme? I guess a simple linechart would already be enough to understand the basic functionality.

Thanks

Sheet1 exists by default

Is there a way to make it so that "Sheet1" isn't created by default?..
I figure this might be a limitation where at least 1 sheet is required. But it would be great if this weren't needed.

Auto width

I'm generating XLSX files to be ready for printing.
Whenever the file is generated, the cell width is sometimes smaller than the content, so the cells overlap.

Is there a way to change the width of a column to fit the widest cell?

Slow to read

I've just tested umya via MultiSQL by selecting 100,000 rows from a CSV (not using umya) file into an XLSX (umya), and I've found that:

Writing files is plenty fast, finished in ~1s.
Reading the 100K row CSV takes >1s.
Reading the 100K row XLSX takes >5m (I gave up). Pins the CPU on 1 core at a time.

Hopefully this is something we can improve.

Love you

Buddy, your crate saaaaaaaaaaaved my life. ๐Ÿ‘

write strategy

It shall operate the content in memory and then write all content into file.
Currently panic in writing process will lead to a corrupt file.

Benchmarks

Is there benchmarks for this crate?

If not, they'd be nice to have.

Integration test files are not available

Hi,

I'm excited about your project! Can you make your test files available? It looks like they are located on your C drive in C:/spread_test_data/... (from integration_test.rs).

Thank you in advance,
Adam M

Corrupt comments

I'm not sure whether or not this was an issue in previous version, not sure whether I had tested with Excel.

Opening a file with comments in excel makes excel complain about problems. Allowing it to recover makes it say that comments were a problem and they were removed.

This was working in ODS with 0.2.0 unsure whether it does with 0.2.1.

Remove Onig and use Regex instead

When building for a target, for which no c/c++ compiler toolchain is present, umya-spreadsheet cannot be built. Especially, when trying to target wasm, it gets annoying to handle the compiler. This is caused by the regular expression engine used (onig), which is a wrapper around a c library.

Further, the zip dependency needs to disable bzip2 support (or at least allow it via e.g. feature flags), and instead relay on flate2, which is a pure rust implementation of some deflate based compression algorithms.

I have a version locally tested to work with regex instead of onig and was also able to use it in the web-browser via wasm-pack. If this is something you are interested in, I can make a PR.

double_value.rs bug

thread '' panicked at 'called Result::unwrap() on an Err value: ParseFloatError { kind: Empty }', D:\RUST\cargo\registry\src\github.com-1ecc6299db9ec823\umya-spreadsheet-0.4.0\src\structs\double_value.rs:28:41
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread 'main' panicked at 'called Result::unwrap() on an Err value: Any { .. }', src\main.rs:483:34

Panic

I'll try to get more details if I can, for now all I can give is that when opening a sheet I'm getting:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', .../umya-spreadsheet-0.5.3/src/structs/stylesheet.rs:160:18

`get_cell_by_column_and_row_mut` casuses panic

Code:

use umya_spreadsheet;

pub fn write_strings(
    sheet: &mut Worksheet,
    strings: &[&str],
    row_target: usize,
    start_index: usize,
) {
    for (i, &text) in strings.iter().enumerate() {
        let col = start_index + i;
        sheet
            .get_cell_by_column_and_row_mut(col, row_target)
            .set_value(text)
            .expect("Failed to write to sheet");
    }
}

panic:

thread 'main' panicked at 'attempt to subtract with overflow', /home/spyros/.cargo/registry/src/github.com-1ecc6299db9ec823/umya-spreadsheet-0.1.14-beta/src/structs/worksheet.rs:138:48
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:217
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:526
  11: rust_begin_unwind
             at src/libstd/panicking.rs:437
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  13: core::panicking::panic
             at src/libcore/panicking.rs:50
  14: umya_spreadsheet::structs::worksheet::Worksheet::get_cell_by_column_and_row_mut
             at /home/spyros/.cargo/registry/src/github.com-1ecc6299db9ec823/umya-spreadsheet-0.1.14-beta/src/structs/worksheet.rs:138
  15: support::utils::write_strings
             at src/utils.rs:89
  16: support::main
             at src/main.rs:45
  17: std::rt::lang_start::{{closure}}
             at /home/spyros/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:67
  18: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  19: std::panicking::try::do_call
             at src/libstd/panicking.rs:348
  20: std::panicking::try
             at src/libstd/panicking.rs:325
  21: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  22: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  23: std::rt::lang_start
             at /home/spyros/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:67
  24: main
  25: __libc_start_main

Sorry for all the edits, I thought the error was something else until I saw the full backtrace

Update: I understand now that you assume colums start at 1 but I find this a little weird?
Even though it's excel, we are still programmers and usually indexes start at 0.
Anyway, maybe at least mention this somewhere in the docs

get_cell_by_column_and_row etc. function can be more efficient

for example

for cell in &mut self.index {

when calling get_cell_by_column_and_row_mut to get a new cell, it will basically enumerate all cells two times.

I think that using hashmap with coordinate as the key to store the cells is better idea.

pub struct Cells {
    index: HashMap<(usize,usize), Cell>,
    default_cell_value: CellValue,
    default_style: Style,
}

pub fn get_cell_by_column_and_row_mut(&mut self, col: usize, row: usize) -> &mut Cell {
    let c = self.map.entry((col, row)).or_insert(Cell::default());
    c
}

lazy load lead to corruption

when using lazy reading, the saved file can not open by ms office.
Files directly created by this crate have no such issue.
Related to unsupported features?

data loss

when use get_formatted_value, a number with length 18 with text format is converted to a string which last bit number is zero

fix return for get_mut functions

pub fn get_axis_id_mut(&mut self) -> &AxisId {

pub fn get_scaling_mut(&mut self) -> &Scaling {

pub fn get_delete_mut(&mut self) -> &Delete {

pub fn get_axis_position_mut(&mut self) -> &AxisPosition {

pub fn get_major_gridlines_mut(&mut self) -> &Option<MajorGridlines> {

pub fn get_title_mut(&mut self) -> &Option<Title> {

pub fn get_major_tick_mark_mut(&mut self) -> &MajorTickMark {

pub fn get_minor_tick_mark_mut(&mut self) -> &MinorTickMark {

pub fn get_tick_label_position_mut(&mut self) -> &TickLabelPosition {

pub fn get_tick_crossing_axis_mut(&mut self) -> &CrossingAxis {

pub fn get_show_legend_key_mut(&mut self) -> &ShowLegendKey {

pub fn get_show_value_mut(&mut self) -> &ShowValue {

pub fn get_show_category_name_mut(&mut self) -> &ShowCategoryName {

pub fn get_show_series_name_mut(&mut self) -> &ShowSeriesName {

pub fn get_show_percent_mut(&mut self) -> &ShowPercent {

pub fn get_show_bubble_size_mut(&mut self) -> &ShowBubbleSize {

pub fn get_show_leader_lines_mut(&mut self) -> &Option<ShowLeaderLines> {

feature request: add supoprt AsRef<Path> argument for reader/writers

Current reader/writer argument spec ( path: &str ):

umya_spreadsheet::reader::read( std::path::Path::new( "./some.xlsx" ) ) // ๐Ÿ†—
umya_spreadsheet::reader::read( "./some.xlsx" ) // ๐Ÿ†–

Add support AsRef<Path> argument:

umya_spreadsheet::reader::read( std::path::Path::new( "./some.xlsx" ) ) // ๐Ÿ†—
umya_spreadsheet::reader::read( "./some.xlsx" ) // ๐Ÿ†—
umya_spreadsheet::reader::read( "./some.xlsx".to_string() ) // ๐Ÿ†—
umya_spreadsheet::reader::read( /* Path, PathBuf, &str, String, and etc. */ ) // ๐Ÿ†—

Motivations

  1. I want it to be easy. ๐Ÿคฃ
  2. From the internal implementation point of view, AsRef seems fine. It also improves usability for library users. ๐Ÿ‘ฉโ€๐Ÿ’ป

Merged cells clash with `set_auto_width`

After playing with the new update for a bit, I've noticed that the set_auto_width resizes the column to fit the first cell of the horizontally merged cell.

Behaviour:
image

Expected behaviour:
image

I think that the column isn't calculating for merged cells and just checks what text is in it and it grabs that one.

Any further ideas would be much appreciated.

Opening, saving and closing file in LibreOffice Calc causes issues

I tried opening, saving and closing a sheet in LibreOffice Calc and tried to open the file again and got:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', .../src/structs/vml/spreadsheet/anchor.rs:152:30

set_value("true"); writes `0`

Title basically, I tried the following:

out_sheet
        .get_cell_by_column_and_row_mut(1, 1)
        .set_value("true")
        .expect("Failed to write to sheet");

out_sheet
        .get_cell_by_column_and_row_mut(1, 1)
        .set_value_and_data_type("true", Cell::TYPE_BOOL)
        .expect("Failed to write to sheet");

With both cases when I open the worksheet I see 0 and if I click on it, it has =FALSE()

Can't read a .xlsx file that exported by Google Spreadsheets

Repro

  1. Create a new Google Spreadsheets document.
  2. File -> Download -> Microsoft Excel (.xlsx)
  3. Use umya_spreadsheet::reader::xlsx::read_reader/read to the file.

Error log

panicked at 'called `Result::unwrap()` on an `Err` value: Zip(FileNotFound)', C:\Users\usagi\.cargo\registry\src\github.com-1ecc6299db9ec823\umya-spreadsheet-0.6.0\src\reader\xlsx.rs:76:46
stack backtrace:
(...brabrabra...)

Note

  • Once this file is opened in Microsoft Excel and saved over, it no longer causes problems.

Ranges for complete row fail parsing

I have a workbook which contains a definition for a complete row (Sheet1!$6:$6). Opening the workbook fails at umya_spreadsheet::helper::coordinate::coordinate_from_string as the regex [A-Z]+ returns None but gets unwrapped unconditionally:

pub fn coordinate_from_string(coordinate:&str)->Vec<&str> {
    let re = Regex::new(r"[A-Z]+").unwrap();
    let caps = re.captures(coordinate).unwrap(); // panic!
    // ...
}

Backtrace:

stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633\/library\std\src\panicking.rs:515
   1: core::panicking::panic_fmt
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633\/library\core\src\panicking.rs:92
   2: core::panicking::panic
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633\/library\core\src\panicking.rs:50
   3: enum$<core::option::Option<regex::re_unicode::Captures>, 1, 18446744073709551615, Some>::unwrap<regex::re_unicode::Captures>
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633\library\core\src\option.rs:388
   4: umya_spreadsheet::helper::coordinate::coordinate_from_string
             at C:\Users\mfaux\source\rust\umya-spreadsheet\src\helper\coordinate.rs:66
   5: umya_spreadsheet::helper::coordinate::index_from_coordinate<alloc::string::String>
             at C:\Users\mfaux\source\rust\umya-spreadsheet\src\helper\coordinate.rs:98
   6: umya_spreadsheet::structs::range::Range::set_range<str>
             at C:\Users\mfaux\source\rust\umya-spreadsheet\src\structs\range.rs:26
   7: umya_spreadsheet::structs::address::Address::set_address<alloc::string::String>
             at C:\Users\mfaux\source\rust\umya-spreadsheet\src\structs\address.rs:40
   8: umya_spreadsheet::structs::defined_name::DefinedName::set_address<alloc::string::String>
             at C:\Users\mfaux\source\rust\umya-spreadsheet\src\structs\defined_name.rs:32
   9: umya_spreadsheet::reader::xlsx::workbook::read
             at C:\Users\mfaux\source\rust\umya-spreadsheet\src\reader\xlsx\workbook.rs:55
  10: umya_spreadsheet::reader::xlsx::read
             at C:\Users\mfaux\source\rust\umya-spreadsheet\src\reader\xlsx.rs:82
  11: palcreator::run
             at .\src\lib.rs:30
  12: palcreator::main
             at .\src\main.rs:13
  13: core::ops::function::FnOnce::call_once<fn(),tuple<>>

`Style`

Is there a better way than this?:

let mut color = Color::default();
color.set_tint(0.2);
let mut pattern_fill = PatternFill::default();
pattern_fill.set_background_color(color);
let mut fill = Fill::default();
fill.set_pattern_fill(pattern_fill);
let mut style = Style::default();
style.set_fill(fill);

How set colors?

I trying to set the colors for a rows of tables like:

fn _style_row(sheet: &mut Worksheet, row: u32, len: u32, b: &str, f: &str) {
        let bg = Color::default().set_argb(b).to_owned();
        let fg = Color::default().set_argb(f).to_owned();
        let fill = PatternFill::default()
            .set_background_color(bg)
            .set_foreground_color(fg)
            .to_owned();

        for col in 0..len {
            sheet
                .get_style_by_column_and_row_mut(col + 1, row + 1)
                .get_fill_mut()
                .set_pattern_fill(fill.clone());
        }
    }

        _style_row(
            sheet,
            0,
            header.len() as u32,
            Color::COLOR_BLACK,
            Color::COLOR_WHITE,
        );

But the cells all show without the colors...

Book layout level font settings are lost

Repro.

  1. Create a test input.xlsx file using Excel that has:
  • (a) layout level font settings.
  • (b) some text in any cell. (Do NOT set the cell level font settings.)
  1. Read: let book = umya_spreadsheet::reader::xlsx::read(Path::new("input.xlsx")).unwrap()
  2. Write: umya_spreadsheet::writer::xlsx::write(&book, Path::new("output.xlsx")).unwrap()

Screenshots

Font settings(set from layout settings) of "input.xlsx"

Set the layout level font settings.

image

  • โ†‘: Menu -> "Page Layout" -> over the mouse cursor on "Fonts" of the "Themes" section of the menu ribbon.

image

  • โ†‘: It applied the font settings from the layout settings. (It is NOT set from the cell level font settings.)

Font settings(set from layout settings) of "output.xlsx"

Layout level font settings are lost.

image

  • โ†‘: Lost the layout level font settings and set the default of application level font settings.

image

  • โ†‘: Lost the layout level font settings

the to_formatted_string isn't handling date formats well

the following code :

let x1 = umya_spreadsheet::NumberFormat::FORMAT_DATE_YYYYMMDD;
let x2 = umya_spreadsheet::NumberFormat::FORMAT_DATE_YYYYMMDD2;
let x3 = umya_spreadsheet::NumberFormat::FORMAT_DATE_YYYYMMDDSLASH;
let x4 = umya_spreadsheet::NumberFormat::FORMAT_DATE_DATETIME;
let x5 = umya_spreadsheet::NumberFormat::FORMAT_DATE_DDMMYYYY;
let x6 = umya_spreadsheet::NumberFormat::FORMAT_DATE_DMMINUS;
let x7 = umya_spreadsheet::NumberFormat::FORMAT_DATE_DMYMINUS;
let x8 = umya_spreadsheet::NumberFormat::FORMAT_DATE_DMYSLASH;
let x9 = umya_spreadsheet::NumberFormat::FORMAT_DATE_XLSX22;
let x10 = umya_spreadsheet::NumberFormat::FORMAT_DATE_XLSX17;
let x11 = umya_spreadsheet::NumberFormat::FORMAT_DATE_XLSX16;
let x12 = umya_spreadsheet::NumberFormat::FORMAT_DATE_XLSX15;
let x13 = umya_spreadsheet::NumberFormat::FORMAT_DATE_XLSX14;
println!("{:?}", to_formatted_string(cell.get_value(), &x1.to_string()));
println!("{:?}", to_formatted_string(cell.get_value(), &x2.to_string()));
println!("{:?}", to_formatted_string(cell.get_value(), &x3.to_string()));
println!("{:?}", to_formatted_string(cell.get_value(), &x4.to_string()));
println!("{:?}", to_formatted_string(cell.get_value(), &x5.to_string()));
println!("{:?}", to_formatted_string(cell.get_value(), &x6.to_string()));
println!("{:?}", to_formatted_string(cell.get_value(), &x7.to_string()));
println!("{:?}", to_formatted_string(cell.get_value(), &x8.to_string()));
println!("{:?}", to_formatted_string(cell.get_value(), &x9.to_string()));
println!("{:?}", to_formatted_string(cell.get_value(), &x10.to_string()));
println!("{:?}", to_formatted_string(cell.get_value(), &x11.to_string()));
println!("{:?}", to_formatted_string(cell.get_value(), &x12.to_string()));
println!("{:?}", to_formatted_string(cell.get_value(), &x13.to_string()));

presents the following output
"2024-%m-%d"
"2024-%m-%d"
"2024/%m/%d"
"12/05/24 0:00"
"%d/%m/2024"
"12-05"
"12-05-24"
"12/05/24"
"05/12/24 0:00"
"May-24"
"12-May"
"12-May-24"
"%m-%d-24"

keep in mind that the data structure in the excel file is a correct date, I tried using different ways to represent the date in the excel cell but the result is the same, from the output above the date isn't always parsed correctly and I need the date to be formatted as DD/MM/YYYY

Difference to calamine?

Hey, this crate just popped up in my github explore page and it seems pretty similar to calamine. What does this crate do differently?

Info about this would be nice to have in the README too

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.