这个是用c#代码生成的stream,生成方法是这样:
var workbook = new GrapeCity.Documents.Excel.Workbook();
var worksheet = workbook.Worksheets[0];
var rowCount = list.GetLength(0) + 1;
var colCount = list.GetLength(1) + 1;
worksheet.Range[0, 0 ,rowCount, colCount].Value = list;
MemoryStream ms = new MemoryStream();
var saveOption = new GrapeCity.Documents.Excel.XlsxSaveOptions();
saveOption.IsCompactMode = true;
workbook.Save(ms, saveOption);
Byte[] buffer = ms.GetBuffer();
MemoryStream msResult = new MemoryStream(buffer);
var result = new FileStreamResult(
msResult,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
return result; // 后端返回的filestream
|