Я могу загрузить Excel через сервер отчетов. Я пытался использовать EpPlus, но я не смог использовать его со средством просмотра отчетов.Я хочу добавить пароль в файл Excel.
public static void SendFileBytes(HttpResponse response, byte[] fileBytes, string fileName, string mimeType)
{
if (response != null && fileBytes != null && fileBytes.Length > 0 && !String.IsNullOrWhiteSpace(fileName) && !String.IsNullOrWhiteSpace(mimeType))
{
response.Clear();
response.Buffer = true;
response.ContentEncoding = System.Text.Encoding.UTF8;
response.ContentType = mimeType; // "application/pdf";
response.AddHeader("content-disposition", "attachment;filename=" + Uri.EscapeDataString(fileName));
response.Charset = "";
response.Cache.SetCacheability(HttpCacheability.NoCache);
using (BinaryWriter bw = new BinaryWriter(response.OutputStream))
{
bw.Write(fileBytes);
bw.Close();
}
response.Flush();
response.End();