Back to "Dom klein ding...klasse die een Excel compatibele tabel uit een DataSet levert"

This is a viewer only at the moment see the article on how this works.

To update the preview hit Ctrl-Alt-R (or ⌘-Alt-R on Mac) or Enter to refresh. The Save icon lets you save the markdown file to disk

This is a preview from the server running through my markdig pipeline

ASP.NET C# Imported mostlylucidcouk

Dom klein ding...klasse die een Excel compatibele tabel uit een DataSet levert

Friday, 26 March 2004

Zeer eenvoudig en gebaseerd op de een waar ik eerder over blogde Hoe dan ook, koppel dit aan een link knop, pas in een dataset en het zal een downloadbaar Excel compatibel bestand...

publieke klasse GetExcel

{

publieke statische leegte Convert(DataSet ds, int dataTableId, HttpRespons response, string fileNaam)

{

DataGrid dg = nieuw DataGrid();

dg.DataBron = ds.tabellen[gegevenstabelId];

dg.DataBind();

respons.buffer = waar;

respons.ContentType="application/vnd.ms-excel";

response.AddHeader("Content-Disposition," "attachment;filename=" + fileName) ;

met behulp van(StringWriter sw = new StringWriter())

{

met behulp van(HtmlTextWriter writer = nieuwe HtmlTextWriter(sw))

{

dg.RenderControl(writer);

respons.Write(sw.ToString());

}

}

respons.End();

}

publieke statische leegte Convert(DataSet ds, int dataTableId, HttpResrespons response)

{

Convert(ds,dataTableId,respons,"report.xls");

}

publieke statische leegte Convert(DataSet ds, HttpRespons response)

{

Convert(ds,0,respons);

}

}

logo

© 2026 Scott Galloway — Unlicense — All content and source code on this site is free to use, copy, modify, and sell.