archive icon indicating copy to clipboard operation
archive copied to clipboard

archive class to save as file(xlsx) did not work

Open YancyHsu opened this issue 1 year ago • 2 comments

no error display, but when open the Excel file, it shows "File Corrupted"

not worked code:

final outputStream = OutputFileStream(xlsxFilePath);
var outputBytes = ZipEncoder().encode(_archive)!;
outputStream.writeBytes(outputBytes);

YancyHsu avatar Mar 06 '23 08:03 YancyHsu

but when i extract Archive to a folder first, then zip it, it works, the Excel file is OK. So i think something wrong with OutputFileStream, maybe i misuse it? Can somebody help?

worked code:

var outputFolder = 'output';
extractArchiveToDisk(_archive, outputFolder);
var dir = Directory(outputFolder);
var encoder = ZipFileEncoder();
encoder.zipDirectory(dir, filename: xlsxFilePath);
dir.deleteSync(recursive: true);

YancyHsu avatar Mar 06 '23 08:03 YancyHsu

Got similar problem Try with version 3.3.2, until that version it works for me

Tristl avatar Jun 02 '23 14:06 Tristl