Infragistics第三方控件导出数据到excel
来源:互联网 发布:有道语音翻译软件 编辑:程序博客网 时间:2024/05/22 13:20
Infragistics自带导出控件UltraGridExcelExporter,用此控件可以轻松的将UltraWinGrid中的数据导出到excel文件中,而且格式可以自定。
/// <summary>
/// 导出
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnExp_Click(object sender, EventArgs e)
{
if (this.grdCKTZ == null || this.grdCKTZ.Rows.Count == 0)
{
this.label2.Text = "请先查询后导出";
return;
}
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Execl files (*.xls)|*.xls";
saveFileDialog.FilterIndex = 0;
saveFileDialog.RestoreDirectory = true;
saveFileDialog.FileName = "能耗查询表";
string strName = "";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
strName = saveFileDialog.FileName;
if (strName.Length != 0)
{
try
{
//当前目录中已存在此文件
if (System.IO.File.Exists(strName))
{
//删除
System.IO.File.Delete(strName);
}
}
catch
{
this.label2.Text = "导出失败";
return;
}
this.grdCKTZ.DisplayLayout.Bands[0].HeaderVisible = true;
this.grdCKTZ.DisplayLayout.Bands[0].Header.Caption = "报表名字";
this.grdCKTZ.DisplayLayout.Bands[0].Indentation = 0;
this.grdCKTZ.DisplayLayout.RowConnectorStyle = Infragistics.Win.UltraWinGrid.RowConnectorStyle.None;
this.grdCKTZ.DisplayLayout.Bands[0].Header.Appearance.ThemedElementAlpha = Infragistics.Win.Alpha.Transparent;
this.grdCKTZ.DisplayLayout.Bands[0].Header.Appearance.BackColor = Color.LightBlue;
this.grdCKTZ.DisplayLayout.Bands[0].Header.Appearance.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
this.grdExcelExp.Export(this.grdCKTZ, strName);
this.label2.Text = "导出成功";
}
}
}
- Infragistics第三方控件导出数据到excel
- 从Infragistics UltraWebGrid 导出数据到Excel
- 第三方控件应用Infragistics
- 从Infragistics UltraWebGrid 导出数据到Excel续
- 从Infragistics UltraWebGrid 导出数据到Excel再续
- 从Infragistics UltraWebGrid 导出数据到 Excel 序列
- NetAdvantage专区 (第三方控件 infragistics)
- 关于第三方控件Infragistics的安装
- 用第三方控件导出Excel,相对简单
- [Infragistics]利用第三方控件实现仪盘表效果
- 关于VisualStudio2012中使用第三方控件Infragistics如何发布
- 导出CListCtrl控件数据到Excel文件
- 导出CListCtrl控件数据到Excel文件
- 数据绑定控件导出到excel
- 数据导出到Excel
- 数据导出到Excel
- 导出数据到EXCEL
- 导出数据到Excel
- Spring Security tutorial 学习一
- 魔方简单实现(c语言,tc2.0编译通过)不含解魔方的算法
- Enable Python on Apache2 (Ubuntu9.10)
- response.write()输出""
- 原来是虚惊一场...
- Infragistics第三方控件导出数据到excel
- Windows Phone 7 Developer Tools 已经支持Visual Studio 2010 RTM版
- python challenge
- 启动Word 2003时,弹出 “文件转换,要求选择文本编码的对话框" 的解决办法
- MIT技术评论:2010十大新兴技术
- 那些相见恨晚的 JavaScript 技巧
- C++技术文档
- Visual Studio 2005 "查找与替换"界面出不来解决办法
- Are u the 10%?