Skip to content

Commit

Permalink
Merge pull request #959 from DFE-Digital/Spreadsheet-empty
Browse files Browse the repository at this point in the history
Spreadsheet empty
  • Loading branch information
dneed-nimble authored Dec 14, 2023
2 parents 4772c70 + 7d7b62f commit 37c6d58
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Dfe.PrepareConversions.ViewModels;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

Expand Down Expand Up @@ -62,8 +63,18 @@ public async Task<FileStreamResult> OnGetDownload()
}
else
{
return null;
var stream = new MemoryStream();
var writer = new StreamWriter(stream);
writer.Write("");
writer.Flush();
stream.Position = 0;

var fileStreamResult = new FileStreamResult(stream, "text/csv")
{
FileDownloadName = "empty.csv"
};

return fileStreamResult;
}
}

}

0 comments on commit 37c6d58

Please sign in to comment.