private void simpleButton1_Click_1(object sender, EventArgs e)
{
//XLWorkbook wb = new XLWorkbook();
//DataTable dt = BMS_DLL.SQL.SELECT("select * from BMS_MS_RECORDS");
//wb.Worksheets.Add(dt, "WorksheetName");
//wb.SaveAs(@"HelloWorld.xls");
DataTableToExcel(BMS_DLL.SQL.SELECT("select * from BMS_MS_RECORDS"), "HelloWorld.xls");
}
public void DataTableToExcel(DataTable dt, string PATH)
{
GridControl GC = new GridControl();
GridView GV = new GridView();
GC.ViewCollection.Add(GV);
GC.MainView = GV;
GC.BindingContext = new BindingContext();
GC.DataSource = dt;
GV.PopulateColumns();
GC.ForceInitialize();
GV.ExportToXls(PATH);
}
{
//XLWorkbook wb = new XLWorkbook();
//DataTable dt = BMS_DLL.SQL.SELECT("select * from BMS_MS_RECORDS");
//wb.Worksheets.Add(dt, "WorksheetName");
//wb.SaveAs(@"HelloWorld.xls");
DataTableToExcel(BMS_DLL.SQL.SELECT("select * from BMS_MS_RECORDS"), "HelloWorld.xls");
}
public void DataTableToExcel(DataTable dt, string PATH)
{
GridControl GC = new GridControl();
GridView GV = new GridView();
GC.ViewCollection.Add(GV);
GC.MainView = GV;
GC.BindingContext = new BindingContext();
GC.DataSource = dt;
GV.PopulateColumns();
GC.ForceInitialize();
GV.ExportToXls(PATH);
}
No comments:
Post a Comment