
06/03/2007, 03:42
|
| | Fecha de Ingreso: noviembre-2006
Mensajes: 48
Antigüedad: 18 años, 4 meses Puntos: 0 | |
cómo exportar gridview a excel con width de las columnas determinadas hola!!
tengo unos datos que exporto a excel (en realidad, es una tabla en un word), de esta forma:
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=Empresas.xls");
Response.Charset = "";
//Response.ContentType = "application/vnd.xls";
Response.ContentType = "application/excel";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GridView g = new GridView();
g.DataSource = GargarEmpresas();
g.DataBind();
g.RenderControl(htmlWrite);
Response.Write(style);
Response.Write(stringWrite.ToString());
Response.End();
mi cuestión es que las columnas que aparecen en el archivo tienen diferente width, y hay algunos que son muy estrechos. Qué determina el ancho de las columnas?? Me gustaría modificarlas pero no se como. Alguna idea?? |