עבור לתוכן

C# שמירת list בפורמט excel

Featured Replies

פורסם

יש לי DATASET עם נתונים, שאני שומרת ברשימה.

אני רוצה לשמור את הנתונים בקובץ אקסל.

הקוד שכתבתי:

 System.Web.UI.WebControls.DataGrid grid = new System.Web.UI.WebControls.DataGrid();
grid.HeaderStyle.Font.Bold = true;
grid.DataSource = lstStatistic;
grid.DataBind();
// render the DataGrid control to a file using (StreamWriter sw = new StreamWriter("c:\\test.xls"))
{
using (HtmlTextWriter hw = new HtmlTextWriter(sw))
{
grid.RenderControl(hw);
}
}

הבעיה היא - שבקובת אקסל נשמרת לי רק העמודה הראשונה מהDATASET.

מדוע?

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים