日期:2014-05-17 浏览次数:21895 次
private void ExportExcel()
{
DataTable dtVilationList = Grab.GetVilationList(guid.ToString());
SaveFileDialog dlg = new SaveFileDialog()
{
Filter = "*.xls|*.xls",
RestoreDirectory = true,
FileName = DateTime.Now.ToString("yyyyMMddhhmmss")
};
if (dlg.ShowDialog() == DialogResult.OK)
{
string[] columns = new string[] {
"车牌","违规时间","违规行为","违规地点","罚款金额","扣分","异地办理费"
};
int i = 0;
foreach (string c in columns)
{
dtVilationList.Columns[i++].ColumnName = c;
}
CSD.Tools.DownExcel downExcel = new CSD.Tools.DownExcel();
downExcel.Width(0, 16);
downExcel.Width(1, 18);
downExcel.Width(2, 35);
downExcel.Width(3, 35);
downExcel.Width(6, 16);
downExcel.File(dtVilationList, dlg.FileName);
MessageBox.Show("导出成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}