We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Have an error message when opening xlsx file

hello,
I have an issue when I try to open xlsx file after converting html to xlsx.
all things are fine until I send the Binary result on using Response.BinaryWrite.
example:
Response.ContentType = “application/xlsx”;
Response.AddHeader(“Content-disposition”, $“attachment;filename=Filename.xlsx;”);
var result = Encoding.Default.GetBytes(document);
//ByteArrayToFile(@“export.xlsx”, result); at this step if I save the Binary directly in file it’s work.
Response.BinaryWrite(result);

the result when I download th content in my front. I have this message :

We’re sorry. We can’t open {file} because we found a problem with its contents.

image.png (4.4 KB)
it’s opend when I click on OK.
I want to avoid this message please help me.

@Benabdallah_Sabti,

The issue does not seem to be related to Aspose.Cells APIs. Could you please add a line (at the end) to your code segment if it makes any difference.
Response.End();

Also, try using latest version of Aspose.Cells v21.7 (if you are not already using it). If you still find any issue with latest version of Aspose.Cells, kindly create a sample project (runnable), zip the project and post us to reproduce the issue (with resource files) on our end, we will check it soon.

Thank you, it’s work now :blush:

@Benabdallah_Sabti,

Good to know that your issue is sorted out by the suggested line of code. In the event of further queries or issue, feel free to write us back.