Entradas

Mostrando las entradas etiquetadas como export to excel

Generar Excel desde Asp.net C# / Generate Excel from Asp.net C#

Este código lo copié de la siguiente página (Original code from link below): http://www.buayacorp.com/archivos/exportar-el-contenido-de-un-gridview-a-excel/ Just create a page with a Gridview called GridView1 on it. Cree una página con un Gridview llamado GridView1 en ella. Then add a "Export to Excel" button and double clic on it, copy and paste the code below. Luego adiciona un botón "Exportar a Excel" y dele doble clic, copie y pegue el siguiente código: Yo adiciono las siguientes líneas para ahorrar un tiempito adicional: I add the following lines to save time: //added using System; using System.Collections.Generic; //using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; using System.IO; //end StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); HtmlTextWriter htw = new HtmlTextWriter(sw); Page page = new Page(); HtmlForm form = new HtmlForm(); GridView1.EnableViewState = false; /...