umya-spreadsheet icon indicating copy to clipboard operation
umya-spreadsheet copied to clipboard

Corrupt comments

Open KyGost opened this issue 3 years ago • 7 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.

KyGost avatar May 07 '22 00:05 KyGost

Thank you for contacting us. We will investigate the cause.

MathNya avatar May 07 '22 15:05 MathNya

Finally checked this. Comments do work in LibreOffice Calc

KyGost avatar May 19 '22 09:05 KyGost

I could not reproduce the error here. Hmmm, maybe it depends on the Excel version.

MathNya avatar Jun 03 '22 14:06 MathNya

I also encountered a similar problem.

how to reproduce

create the xlsx file

Download WPS office from it's official website. WPS office is a very popular office software in China that has similar functionalities as Microsoft Office.

Then create a new workbook, create a new worksheet, insert any text in a new cell, and insert comment to the cell, save it as "wps_comment.xlsx".

run the code

run the following code to open and save the xlsx file as "wps_comment_corrupted.xlsx"

use std::path::Path;
use umya_spreadsheet::{Spreadsheet, Worksheet};
// umya_spreadsheet version = 1

fn main() {
    let xlsx_path = Path::new("./wps_comment.xlsx");

    let mut wb = umya_spreadsheet::reader::xlsx::read(xlsx_path).unwrap();

    // save to new file
    let parent = xlsx_path.parent().unwrap();
    let new_file = parent.join("wps_comment_corrupted.xlsx");
    
    umya_spreadsheet::writer::xlsx::write(&wb, &new_file).unwrap();
}

use Microsoft Office to open the "wps_comment_corrupted.xlsx"

Note that at this step, you need to use Microsoft Office to open the "wps_comment_corrupted.xlsx" file. If you use WPS Office to open it, no problem will happen. It will show warnings that the some content is problematic. Upon closing the first dialog, a new dialog will be opened showing that "Removed Part: /xl/drawings/vmlDrawing1.vml part. (Drawing shape)".

why use both Microsoft Office and WPS Office

Because in China, a lot of people use WPS Office, and other people use Microsoft Office. So MS Office people very often have to edit excel files received from other people that may be using WPS Office.

related file

You can find attached a "wps_comment.xlsx" file created by me for quick testing.

wellitecho avatar Aug 10 '23 06:08 wellitecho

@wellitecho Thank you for your report. I have confirmed that the error occurs in my environment as well. We will address this in the next version of the software.

MathNya avatar Aug 14 '23 14:08 MathNya

@wellitecho We have completed our response to this matter. Please check the latest version.

MathNya avatar Aug 27 '23 09:08 MathNya

Thank you for your hard work. I tested with version 1.0.1, and the problem is solved.

Thank you. @MathNya

wellitecho avatar Aug 28 '23 09:08 wellitecho