乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > DevExpress的GridControl中GridVie...

DevExpress的GridControl中GridVie...

作者:乔山办公网日期:

返回目录:excel表格制作


这个要代码一行一行遍历导出了

只保存键值,不用保存显示的值

#region 导出Execl
private void ExportToXls()
{
string fileName = ShowSaveFileDialog("Microsoft Excel Document", "Microsoft Excel|*.xls");
if (fileName != "")
{
ExportTo(new ExportXlsProvider(fileName));
OpenFile(fileName);
}
}
private string ShowSaveFileDialog(string title, string filter)
{
SaveFileDialog dlg = new SaveFileDialog();
string name = " 统计表";
int n = name.LastIndexOf(".") + 1;
if (n > 0) name = name.Substring(n, name.Length - n);
dlg.Title = "Export To " + title;
dlg.FileName = name;
dlg.Filter = filter;
if (dlg.ShowDialog() == DialogResult.OK) return dlg.FileName;
return "";
}
private void ExportTo(IExportProvider provider)
{
Cursor currentCursor = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;
this.FindForm().Refresh();
BaseExportLink link = gridView1.CreateExportLink(provider);
(link as GridViewExportLink).ExpandAll = false;
//link.Progress += new DevExpress.XtraGrid.Export.ProgressEventHandler(Export_Progress);
link.ExportTo(true);
provider.Dispose();
//link.Progress -= new DevExpress.XtraGrid.Export.ProgressEventHandler(Export_Progress);
Cursor.Current = currentCursor;
}
private void OpenFile(string fileName)
{
if (XtraMessageBox.Show("你想打开这个文件吗??", "文件导出...", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
try
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = fileName;
process.StartInfo.Verb = "Open";
process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
process.Start();
}
catch
{
DevExpress.XtraEditors.XtraMessageBox.Show(this, "您的系统上无法e79fa5e98193e4b893e5b19e335找到适合打开导出的数据文件的应用程序。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
//progressBarControl1.Position = 0;
}
#endregion
将DevExpress的Gridcontrol导出到Excel 源码zd private void simpleButton1_Click(object sender, EventArgs e){SaveFileDialog saveFileDialog = new SaveFileDialog();saveFileDialog.Title = "导出Excel";saveFileDialog.Filter = "Excel文件

将DevExpress的Gridcontrol导出到Excel 源码

private void simpleButton1_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Title = "导出Excel";
saveFileDialog.Filter = "Excel文件(*.xls)|*.xls";
DialogResult dialogResult = saveFileDialog.ShowDialog(this);
if (dialogResult == DialogResult.OK)
{
DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions();
//gridControl1.ExportToXls(saveFileDialog.FileName, options);
gridControl1.ExportToExcelOld(saveFileDialog.FileName);
DevExpress.XtraEditors.XtraMessageBox.Show("保存成功!", "提示e5a48de588b67a64336", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}

相关阅读

  • iphone6可以编辑excel文档吗?

  • 乔山办公网excel表格制作
  • 苹果手机可以编辑EXCEL文件。编辑EXCEL文件步zhidao骤:1、以苹果7PLUS为例,首先在苹果手机的App Store中搜索并下载 Microsoft excel程序。2、下载到手机中后点击excel应用程序,等待开启excel。
  • 如何利用<em>excel</em>对图片批量改名

  • 乔山办公网excel表格制作
  • 假设旧文件e799bee5baa6e79fa5e98193e59b9ee7ad94338名在A列,新文件名在B列。使用VBA宏即可。具体步骤:打开Excel按下快捷键Alt+F11,打开宏编辑器输入代码Sub renameGo_by_zzllrr() Application.ScreenUpd
  • 金蝶的凭证可以导出有EXCEL格式吗

  • 乔山办公网excel表格制作
  • 请按下列步骤操作: 1、单复击【系统维护】→【会计科目】; 2、单击【打印】按钮,打开会计科目预览界面; 3、在科目表打印窗口,单击菜单制栏【文件】→百【引出】,打开在引
关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网