MathNya / umya-spreadsheet

A pure rust library for reading and writing spreadsheet files
MIT License
276 stars 44 forks source link

Data lost in other cells of worksheet #77

Closed pratik-mahamuni closed 2 years ago

pratik-mahamuni commented 2 years ago

Thank you for this utility. Its very helpful.

I have facing this issue, where I have a template and I fill it with values using this library. When I write values into the concerned sheet, the sheet changes in weird ways. See picture. The sheet on the left hand is the template with no value in B3. Then I use the code below to write to B3 a float value. On the right hand most of my important formulas are gone (denoted by red lines). Not sure if I am using the library wrong.

    let template_path = Path::new("Template - Copy.xlsx");
    let filename: String = get_new_scorecard_filename(true, &mat_pathname)?;
    let mut book = match umya_spreadsheet::reader::xlsx::read(template_path) {
        Ok(book) => book,
        Err(_e) => return Err("Template spreadsheet could not be loaded".into()),
    };
    book.get_sheet_by_name_mut("Sheet1").unwrap()
        .get_cell_mut("B3")
        .set_value(bagwise["Cycle"][0].to_string());

    let _ = umya_spreadsheet::writer::xlsx::write(&book, filename);

image

MathNya commented 2 years ago

Thank you for your report. We have addressed this issue as soon as possible. Version 0.8.1 has been released. Please obtain this and check the operation.

pratik-mahamuni commented 2 years ago

@MathNya thank you for the quick update and release. I appreciate it. It works great. I tested it out on my use case and the issue no longer persists.

Another small issue that I found was the changing of fonts for the rows and column heads in the Excel document, and overriding fonts in random places where cells are written. Please see pictures. Let me know if you can fix that as well. Thank you.

image image

MathNya commented 2 years ago

@pratik-mahamuni Thank you for your confirmation.

We are currently investigating the issue regarding font settings. We have not yet been able to reproduce the problem in our environment. We will have to wait for a while before we can respond to the issue.

pratik-mahamuni commented 2 years ago

Thank you @MathNya. The original problem is addressed. Closing the issue.