private void ExportRecord(GridControl grid) { SaveFileDialog fileDialog = new SaveFileDialog(); fileDialog.Title = "导出Excel"; fileDialog.Filter = "Excel (*.xls)|*.xls"; DialogResult dialogResult = fileDialog.ShowDialog(this); if (dialogResult == DialogResult.OK) { string orderNo = inboundView.GetFocusedRowCellValue("ProductNo").ToString(); ExportGridView.ExportRecord(orderNo, this.recordView, fileDialog.FileName); if (System.IO.File.Exists(fileDialog.FileName)) { System.Diagnostics.Process.Start(fileDialog.FileName); //保存v } } }
/// <summary> /// exoprt /// </summary> /// <param name="grid"></param> private void ExportDetail(GridControl grid) { SaveFileDialog fileDialog = new SaveFileDialog(); ///储存文件提示框类 fileDialog.Title = "导出Excel"; ///标题 fileDialog.Filter = "Excel (*.xls)|*.xls"; ///存储类型 DialogResult dialogResult = fileDialog.ShowDialog(this); if (dialogResult == DialogResult.OK) { ExportGridView.ExportDetail(this.detailView, fileDialog.FileName); if (System.IO.File.Exists(fileDialog.FileName)) { System.Diagnostics.Process.Start(fileDialog.FileName); //保存v } } }
private void btnExport_Click(object sender, EventArgs e) { SaveFileDialog fileDialog = new SaveFileDialog(); ///储存文件提示框类 fileDialog.Title = "导出Excel"; ///标题 fileDialog.Filter = "Excel (*.xls)|*.xls"; ///存储类型 DialogResult dialogResult = fileDialog.ShowDialog(this); if (dialogResult == DialogResult.OK) { ExportGridView.ExportDetail(this.masterView, fileDialog.FileName); if (System.IO.File.Exists(fileDialog.FileName)) { System.Diagnostics.Process.Start(fileDialog.FileName); //保存v } } }
private void PrintGrid(GridControl grid) { string orderNo = inboundView.GetFocusedRowCellValue("ProductNo").ToString(); string tempFile = AppConfig.GetTempDirectory() + Database.GetGlobalKey() + ".xls"; if (grid == detailGrid) { ExportGridView.ExportDetail(this.detailView, tempFile); } else { ExportGridView.ExportRecord(orderNo, this.recordView, tempFile); } if (System.IO.File.Exists(tempFile)) { System.Diagnostics.Process.Start(tempFile); //保存v } }