Loading CSV File from FileStream returned 'Cannot read that as a ZipFile' Exception

Hi,

When I try to load the following CSV file using the code below:

Workbook book = new Workbook('from file stream');

I get the following exception: Cannot read that as a ZipFile

Note: - If I load the file using FilePath not stream it loads successfully

- I am using Aspose.Cells 7.3.4.0

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please download and use the latest version: Aspose.Cells
for .NET v7.3.5.1
.

We have looked into your issue in detail and we were able to find this issue when the workbook is created using file stream.

However, when the workbook is created using file path, the issue does not occur. The first code throws exception, the second code works fine. Please check the attached output pdf generated by the second code.

We have logged this issue in our database. We will look into this issue and fix it. Once the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-41303.

I have also attached the screenshot showing exception for a reference.

C# - Code 1


string filePath = @“F:\Shak-Data-RW\Downloads\Spreadsheet_Comma+Separated.csv”;


FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);

var workbook = new Workbook(fs);


C# - Code 2
string filePath = @"F:\Shak-Data-RW\Downloads\Spreadsheet_Comma+Separated.csv";
var workbook = new Workbook(filePath);
workbook = new Workbook(filePath);
workbook.Save(filePath + ".out.pdf", SaveFormat.Pdf);

Exception:
An unhandled exception of type '”.””' occurred in Aspose.Cells.dll

Additional information: Cannot read that as a ZipFile

Screenshot:
Digitech:

Hi,

When I try to load the following CSV file using the code below:

Workbook book = new Workbook('from file stream');

I get the following exception: Cannot read that as a ZipFile

Note: - If I load the file using FilePath not stream it loads successfully

- I am using Aspose.Cells 7.3.4.0

Hi,

Thanks for your posting and using Aspose.Cells.

We have looked into your issue further and found that when the file is loaded from stream, we are unable to tell what is a separator for it.

Please specify which character is a separator. Please see the following code and the comment for more help.

C#
string filePath = @"F:\Shak-Data-RW\Downloads\Spreadsheet_Comma+Separated.csv";

//Please specify separator to get rid of this exception
TxtLoadOptions opts = new TxtLoadOptions();
opts.Separator = ',';

FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
Workbook workbook = new Workbook(fs, opts);
workbook.Save(filePath + ".out.pdf");