网上很多资料都是针对winform的,WPF资料比较少。还好我足够聪明,自己想到了办法,嘿嘿。。。。直接看代码吧!
private void ExportToExcel_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Title = "导出Excel";
saveFileDialog.Filter = "Excel文件(*.xls)|*.xls";
bool? Result = saveFileDialog.ShowDialog(this);
if (Result ==true)
{
DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions();
TableView1.ExportToXls(saveFileDialog.FileName);
}
}