<commit_before>﻿// <copyright company="Chirojeugd-Vlaanderen vzw">
// Copyright (c) 2007-2010
// Mail naar <EMAIL> voor alle info over deze broncode
// </copyright>

using System.IO;
using System.Web;
using System.Web.Mvc;

namespace Chiro.Gap.WebApp
{
	/// <summary>
	/// Actionresult voor een Exceldocument.  Schaamteloos overgenomen van
	/// http://stephenwalther.com/blog/archive/2008/06/16/asp-net-mvc-tip-2-create-a-custom-action-result-that-returns-microsoft-excel-documents.aspx
	/// </summary>
	public class ExcelResult : ActionResult
	{
		private readonly string _fileName;
		private readonly MemoryStream _stream;

		public ExcelResult(MemoryStream stream, string fileName)
		{
			_stream = stream;
			_fileName = fileName;
		}

		public override void ExecuteResult(ControllerContext cContext)
		{
			HttpContext context = HttpContext.Current;
			context.Response.Clear();
			context.Response.AddHeader("content-disposition", "attachment;filename=" + _fileName);
			context.Response.Charset = string.Empty;
			context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
			context.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
			// context.Response.Write(content);
			context.Response.BinaryWrite(_stream.ToArray());
			context.Response.End();
		}
	}
}
<commit_msg>refs #775  alvast het mimetype juister geformateerd. Nu de inhoud van den Excel nog fixen.<commit_after>﻿// <copyright company="Chirojeugd-Vlaanderen vzw">
// Copyright (c) 2007-2010
// Mail naar <EMAIL> voor alle info over deze broncode
// </copyright>

using System.IO;
using System.Web;
using System.Web.Mvc;

namespace Chiro.Gap.WebApp
{
	/// <summary>
	/// Actionresult voor een Exceldocument.  Schaamteloos overgenomen van
	/// http://stephenwalther.com/blog/archive/2008/06/16/asp-net-mvc-tip-2-create-a-custom-action-result-that-returns-microsoft-excel-documents.aspx
	/// </summary>
	public class ExcelResult : ActionResult
	{
		private readonly string _fileName;
		private readonly MemoryStream _stream;

		public ExcelResult(MemoryStream stream, string fileName)
		{
			_stream = stream;
			_fileName = fileName;
		}

		public override void ExecuteResult(ControllerContext cContext)
		{
			HttpContext context = HttpContext.Current;
			context.Response.Clear();
			context.Response.AddHeader(@"content-disposition", @"attachment; filename=" + _fileName);
			context.Response.Charset = string.Empty;
			context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
			context.Response.ContentType = @"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
			context.Response.BinaryWrite(_stream.ToArray());
			context.Response.End();
		}
	}
}

{'fraction_non_alphanumeric': 0.11694854264123786, 'fraction_numerical': 0.013314141777617848, 'mean_word_length': 3.8180242634315427, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3003090', 'n_tokens_mistral': 947, 'n_tokens_neox': 845, 'n_words': 166}