IRenderingExtension rendering; var settings = new NameValueCollection();
switch (type)
{ case "xls":
rendering = new ExcelRenderingExtension(); break; case "docx":
rendering = new WordRenderingExtension();
settings.Add("FileFormat", "OOXML");
break; case "html":
rendering = new HtmlRenderingExtension();
settings.Add("StyleStream", "false");
settings.Add("EmbedImages", "true");
settings.Add("IncludePageMargins", "true");
settings.Add("Mode", "Paginated");
break;
case "pdf": default:
type = "pdf";
rendering = new PdfRenderingExtension(); break;
}
var streamProvider = new FileStreamProvider(_context.OutputDirectory, id);
doc.Render(rendering, streamProvider, settings, true);