If I download an .xlsx document every empty space will be filled with a diamond that has a question mark inside it.
What I am doing is:
I have a html string of a .xlsx document that I convert it to a Workbook using:
Aspose.Cells.LoadOptions loadOptions = new Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.Html);
System.IO.Stream stream = new System.IO.MemoryStream(ASCIIEncoding.Default.GetBytes(sourceHTML));
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(stream, loadOptions);
I then save that workbook to a memorystream so that I could download the document:
Response.Clear(); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("Content-Disposition", "attachment; filename = \"" + documentName + "\""); var xlsx = GetWorkbook(documentContent); MemoryStream stream = new MemoryStream(); xlsx.Save(stream, SaveFormat.Xlsx); stream.WriteTo(Response.OutputStream); Response.End();
I tried using:
xlsx.Save(this.Response, documentName, ContentDisposition.Inline, new XlsSaveOptions());
but everytime I opened that document, it would give me an error “Excel cannot open the file because the file format is invalid”.
I am using Aspose.Cells 20.6 and .NET Framework 4.5.2
I attached the .xlsx document that shows the diamond with the question mark inside.
Example.zip (6.4 KB)