MathNya / umya-spreadsheet

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

encrypt xlsx file can not open by wps-office #119

Open flyInRust opened 1 year ago

flyInRust commented 1 year ago

after use writer::xlsx::write_with_password to encrypt some xlsx file,the wps-office can't open this file .

flyInRust commented 1 year ago

and libreoffice can't open the encrypt( writer::xlsx::write_with_password) file too!

MathNya commented 1 year ago

@flyInRust Thank you for your report. I can confirm that libreoffice does not open encrypted files. It probably means that there are parts of the specifications regarding encryption that differ from software to software. It would be difficult to identify the part to be fixed, so it would take some time to modify the program.

flyInRust commented 1 year ago

can u port the function from the msoffice-crypt ?

flyInRust commented 1 year ago

i have create a msoffice-crypt rust bind:

msoffice crypt rust

use msoffice_crypt::{encrypt,decrypt};
fn main() {
        let input = "/home/feiy/Desktop/1.xlsx";
        let output = "/home/feiy/Desktop/output.xlsx";
        let password = "test";
        let ret = encrypt(input,password,Some(output));
        println!("{ret:#?}");
        let plain = "/home/feiy/Desktop/plain.xlsx";
        let ret = decrypt(output,password,Some(plain));
        println!("{ret:#?}");
        let plain = "/home/feiy/Desktop/plain.xlsx";
        let ret = encrypt(plain,password,None);
        println!("{ret:#?}");

}
MathNya commented 1 year ago

@flyInRust Thank you very much. I have looked at msoffice crypt rust. It is a wonderful library.

However, umya-spreadsheet cannot use this library because it must be 100% rust language.

I will refer to it to find the cause of the problem.

flyInRust commented 1 year ago

this is the encrypt References: