Allora questa tua classe:
> classe ( creaFile(percorsoFile)) in cui dopo aver fatto:
> writer = new StreamWriter(percorsoFile + "/nomeFile.xls", false);
> writer.AutoFlush = true;
> writer.WriteLine(sb.ToString());
> writer.Flush();
> writer.Close();
Non può funzionare...
Devi, anzichè salvare il file, mandare lo sream verso il web...
// Invio i dati in formato XLS al browser
this.Page.Response.Clear();
this.Page.Response.Buffer = true;
this.Page.Response.AddHeader("Content-Disposition", "attachment; filename=export.xls");
this.Page.Response.ContentType = "application/vnd.ms-excel";
this.Page.Response.ContentEncoding = System.Text.Encoding.UTF8;
this.Page.Response.Charset = string.Empty;
this.Page.Response.Write(xlsData);
this.Page.Response.End();
In questo modo ti fará fare il download del file xls.
Andrea - http://www.MelisWeb.eu/