void FN_ExportToExcel() { var QueryExcel = sysEmailQuery.AsEnumerable().Select(x => new { name = x.name, email = x.email, port = x.port, isSSL = x.isSSL, smtpClient = x.smtpClient, side = x.side, branchName = x.branchName, isMajor = x.isMajor, notes = x.notes }); var DTForExcel = QueryExcel.ToDataTable(); DTForExcel.Columns[0].Caption = MainWindow.resourcemanager.GetString("trName"); DTForExcel.Columns[1].Caption = MainWindow.resourcemanager.GetString("sssssssssssss"); DTForExcel.Columns[2].Caption = MainWindow.resourcemanager.GetString("sssssssssssssss"); DTForExcel.Columns[3].Caption = MainWindow.resourcemanager.GetString("sssssssssssssss"); DTForExcel.Columns[4].Caption = MainWindow.resourcemanager.GetString("sssssssssssssss"); DTForExcel.Columns[5].Caption = MainWindow.resourcemanager.GetString("sssssssssssssss"); DTForExcel.Columns[6].Caption = MainWindow.resourcemanager.GetString("sssssssssssssss"); DTForExcel.Columns[7].Caption = MainWindow.resourcemanager.GetString("sssssssssssssss"); DTForExcel.Columns[8].Caption = MainWindow.resourcemanager.GetString("trNote"); ExportToExcel.Export(DTForExcel); }
public void ExportToExcel(string fileName) { this.Cursor = System.Windows.Forms.Cursors.WaitCursor; ExportToCSV exporterCSV = new ExportToCSV(_separator); ExportToExcel exporter = new ExportToExcel(); _fileName = fileName; string directory = _fileName.Substring(0, _fileName.LastIndexOf(@"\") + 1); if (_table != null && _fileName != null && !_fileName.Equals(string.Empty) && Directory.Exists(directory)) { _gridLayoutProperties = _manager.GetLayoutProperties(_excludedColumns); if (!exporter.IsOpen(_fileName)) { if (_canExportToExcel) { exporter.Export(_table, _fileName, "Prueba", _gridLayoutProperties); } else { exporterCSV.Export(_table, _fileName, _gridLayoutProperties); } } else // else "Archivo abierto...." { DialogResult result; result = MessageBox.Show("El archivo '" + _fileName + "' se encuentra abierto (Para poder exportar los datos el mismo debe estar cerrado). Ciérrelo y vuelva a intentarlo.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Question); } } this.Cursor = System.Windows.Forms.Cursors.Default; }
//xuất dữ liệu excel private void btnXuatDL_Click(object sender, EventArgs e) { ExportToExcel excel = new ExportToExcel(); //lấy về nguồn dữ liệu DataTable dt = (DataTable)dGV_SHD.DataSource; excel.Export(dt, "Danh Sách 2", "Hóa Đơn Bán", "Số HD", "Ngày lập", "Khách hàng", "Nhân viên", "Số lượng bán", "Đơn giá bán", ""); }
private void btnXuatDuLieu_Click(object sender, EventArgs e) { ExportToExcel excel = new ExportToExcel(); //lấy về nguồn dữ liệu DataTable dt = (DataTable)dGV_Sach.DataSource; excel.Export(dt, "Danh Sách thứ 0", "Quản Lý sách", "Mã sách", "Tên sách", "Thể loại", "Tác giả", "Đơn giá bán", "Số lượng có", ""); }
private void btnXuatDLSP_Click(object sender, EventArgs e) { ExportToExcel excel = new ExportToExcel(); //lấy về nguồn dữ liệu DataTable dt = (DataTable)dGV_SP.DataSource; excel.Export(dt, "Danh Sách 3", "Hóa Đơn Nhập", "Số phiếu", "Mã nhân viên", "Ngày lập", "Nhà cung cấp", "Mã sách", "Số lượng nhập", "Đơn giá nhập"); }
private void btnXuatDuLieu_Click(object sender, EventArgs e) { ExportToExcel excel = new ExportToExcel(); //lấy về nguồn dữ liệu DataTable dt = (DataTable)dGV_ThongKe.DataSource; excel.Export(dt, "Danh Sách", "Thống Kê", "Số hóa đơn", "Ngày lập", "Nhân viên", "Khách hàng", "Tổng tiền", "", ""); }
public void DoExportToExcel(List <IExportReferrals> list) { if (list == null || list.Count == 0) { return; } parent.Cursor = Cursors.WaitCursor; ListtoDataTableConvertor convertor = new ListtoDataTableConvertor(); DataTable dt = convertor.ToDataTable(list); ExportToExcel.Export(dt); parent.Cursor = Cursors.Default; }
void FN_ExportToExcel() { var QueryExcel = medalsQuery.AsEnumerable().Select(x => new { Name = x.name, Notes = x.notes }); var DTForExcel = QueryExcel.ToDataTable(); DTForExcel.Columns[0].Caption = MainWindow.resourcemanager.GetString("trName"); DTForExcel.Columns[1].Caption = MainWindow.resourcemanager.GetString("trNote"); ExportToExcel.Export(DTForExcel); }
public void DoExportToExcel <T>(DataGridViewColumnCollection shown = null) { if (ReportGrid.DataSource == null || ReportGrid.RowCount == 0) { return; } parent.Cursor = Cursors.WaitCursor; ListtoDataTableConvertor convertor = new ListtoDataTableConvertor(); SortableBindingList <T> gridDatasource = ReportGrid.DataSource as SortableBindingList <T>; DataTable dt = convertor.ToDataTable(gridDatasource.ToList(), shown); ExportToExcel.Export(dt); parent.Cursor = Cursors.Default; }
void FN_ExportToExcel() { var QueryExcel = sectionsQuery.AsEnumerable().Select(x => new { Name = x.name, branchName = x.branchName, Notes = x.note }); var DTForExcel = QueryExcel.ToDataTable(); ExportToExcel.Export(DTForExcel); }
private void ExportToExcelButton_Click(object sender, EventArgs e) { CustomizationComparison comparison = ComparisonListView.Items[0].Tag as CustomizationComparison; if (comparison != null) { if (SaveToExcelDialog.ShowDialog() == DialogResult.OK) { string fileWithPath = SaveToExcelDialog.FileName; ExportToExcel exportToExcel = new ExportToExcel(fileWithPath, comparison); exportToExcel.Export(); } } }
void FN_ExportToExcel() { var QueryExcel = storageCostQuery.AsEnumerable().Select(x => new { name = x.name, cost = x.cost, note = x.note }); var DTForExcel = QueryExcel.ToDataTable(); DTForExcel.Columns[0].Caption = MainWindow.resourcemanager.GetString("trName"); DTForExcel.Columns[1].Caption = MainWindow.resourcemanager.GetString("trStorageCost"); DTForExcel.Columns[2].Caption = MainWindow.resourcemanager.GetString("trNote"); ExportToExcel.Export(DTForExcel); }
public async Task <IActionResult> ExportToExcel(VMRuloFilters ruloFilters) { ruloFilters.dtEnd = ruloFilters.dtEnd.AddDays(1).AddMilliseconds(-1); var result = await factory.Rulos.GetRuloListFromFilters(ruloFilters); ExportToExcel export = new ExportToExcel(); string reportName = "Finishing Report"; string fileName = $"Finishing Report_{DateTime.Today.Year}_{DateTime.Today.Month.ToString().PadLeft(2, '0')}_{DateTime.Today.Day.ToString().PadLeft(2, '0')}.xlsx"; var fileResult = await export.Export <VMRulo>("Global Denim S.A. de C.V.", "Finishing", reportName, fileName, result.ToList()); if (!fileResult.Item1) { return(NotFound()); } return(fileResult.Item2); }
void FN_ExportToExcel() { var QueryExcel = possQuery.AsEnumerable().Select(x => new { Name = x.name, Code = x.code, Branch = x.branchName, Notes = x.note }); var DTForExcel = QueryExcel.ToDataTable(); DTForExcel.Columns[0].Caption = MainWindow.resourcemanager.GetString("trName"); DTForExcel.Columns[1].Caption = MainWindow.resourcemanager.GetString("trCode"); DTForExcel.Columns[2].Caption = MainWindow.resourcemanager.GetString("trBranch"); DTForExcel.Columns[3].Caption = MainWindow.resourcemanager.GetString("trNote"); ExportToExcel.Export(DTForExcel); }
partial void ExportIndividuals(NSObject sender) { try { if (Document == null) { NoDocumentLoaded(); return; } ListtoDataTableConvertor convertor = new ListtoDataTableConvertor(); DataTable dt = convertor.ToDataTable(new List <IExportIndividual>(FamilyTree.Instance.AllIndividuals)); ExportToExcel.Export(dt, "Individuals"); Analytics.TrackAction(Analytics.ExportAction, Analytics.ExportIndEvent); } catch (Exception e) { UIHelpers.ShowMessage($"Problem exporting Individuals: {e.Message}"); } }
/// <summary> /// Handles the Click event of the BtnExportExcel control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void BtnExportExcel_Click(object sender, System.Windows.RoutedEventArgs e) { var patientFileName = "Haenggi Results - " + patientInformation.PatientName + ".xlsx"; var saveDialog = new Microsoft.Win32.SaveFileDialog() { Filter = "Excel Files|*.xls, xlsx", FilterIndex = 0, RestoreDirectory = true, FileName = patientFileName, }; var fileName = string.Empty; if (saveDialog.ShowDialog().GetValueOrDefault()) { fileName = saveDialog.FileName; ExportToExcel.Export(theetMessure, mouseMessures, patientInformation, result, fileName); } }
private void FN_ExportToExcel() { var QueryExcel = invItemsQuery.AsEnumerable().Select(x => new { InventoryNumber = x.inventoryNum, Date = x.inventoryDate, SectionLocation = x.section + "-" + x.location, ItemUnit = x.itemName + "-" + x.unitName, Ammount = x.amount }); var DTForExcel = QueryExcel.ToDataTable(); DTForExcel.Columns[0].Caption = MainWindow.resourcemanager.GetString("trInventoryNum"); DTForExcel.Columns[1].Caption = MainWindow.resourcemanager.GetString("trInventoryDate"); DTForExcel.Columns[2].Caption = MainWindow.resourcemanager.GetString("trSectionLocation"); DTForExcel.Columns[3].Caption = MainWindow.resourcemanager.GetString("trItemUnit"); DTForExcel.Columns[4].Caption = MainWindow.resourcemanager.GetString("trAmount"); ExportToExcel.Export(DTForExcel); }
private void btnPrint_Click(object sender, EventArgs e) { ExportToExcel excel = new ExportToExcel(); DataTable dt = new DataTable(); InitTbl(dt); foreach (DataGridViewRow row in dgvListNV.Rows) { DataRow dtrow = dt.NewRow(); dtrow["id"] = row.Cells["MaNV"].Value.ToString(); dtrow["nam"] = row.Cells["TenNV"].Value.ToString(); dtrow["add"] = row.Cells["DiaChi"].Value.ToString(); dtrow["phone"] = row.Cells["SDT"].Value.ToString(); //dtrow[4] = row.Cells["ChucVu"].Value.ToString(); dt.Rows.Add(dtrow); } excel.Export(dt, "Danh sach", "DANH SÁCH CÁC NHÂN VIÊN"); }
partial void ExportLooseDeaths(NSObject sender) { try { if (Document == null) { NoDocumentLoaded(); return; } ListtoDataTableConvertor convertor = new ListtoDataTableConvertor(); List <IDisplayLooseDeath> list = FamilyTree.Instance.LooseDeaths().ToList(); list.Sort(new LooseDeathComparer()); DataTable dt = convertor.ToDataTable(list); ExportToExcel.Export(dt, "LooseDeaths"); Analytics.TrackAction(Analytics.ExportAction, Analytics.ExportLooseDeathsEvent); } catch (Exception e) { UIHelpers.ShowMessage($"Problem exporting Loose Deaths: {e.Message}"); } }
// Создание альбома панелей public void CreateAlbum() { ChangeJob.ChangeJobService.Init(); // Пока не нужны XML панели для создания альбома. //if (StartOptions.NewMode) //{ // BasePanelsService = new BaseService(); // BasePanelsService.ReadPanelsFromBase(); //} // Определение включен ли артикул подписи в плитке (по состоянию замороженности слоя - Артикул пдлитки) //IsTileArticleOn = GetTileArticleState(); // Подсчет общего кол плитки на альбом TotalTilesCalc = TileCalc.CalcAlbum(this); // Создание папки альбома панелей _sheetsSet = new SheetsSet(this); _sheetsSet.CreateAlbum(); // Заполнение атрибутов марок покраски в блоках монтажек try { var libService = new PanelLibrary.PanelLibraryLoadService(); libService.FillMarkPainting(this); this.LibLoadService = libService; } catch (System.Exception ex) { string errMsg = "Ошибка заполнения марок покраски в монтажки - libService.FillMarkPainting(_album);"; this.Doc.Editor.WriteMessage($"\n{errMsg} - {ex.Message}"); Logger.Log.Error(ex, errMsg); } //// Проверка новых панелей, которых нет в библиотеке //try //{ // PanelLibrarySaveService.CheckNewPanels(); //} //catch (Exception ex) //{ // Logger.Log.Error(ex, "Не удалось проверить есть ли новые панели в чертеже фасада, которых нет в библиотеке."); //} // Если есть панели с изменениями - создание задания. try { ChangeJob.ChangeJobService.CreateJob(this); } catch (System.Exception ex) { Inspector.AddError($"Ошибка при создании Задания на Изменение марок покраски - {ex.Message}"); } // Еспорт списка панелей в ексель. try { ExportToExcel.Export(this); } catch (System.Exception ex) { Logger.Log.Error(ex, "Не удалось экспортировать панели в Excel."); } // вставка итоговой таблицы по плитке try { TotalTileTable tableTileTotal = new TotalTileTable(this); tableTileTotal.InsertTableTotalTile(); } catch (System.Exception ex) { Logger.Log.Error(ex, "Не удалось вставить итоговую таблицу плитки на альбом."); } }
private void ExportToExcelButton_OnClick(object sender, RoutedEventArgs e) { ExportToExcel.Export(ProviderDataGrid); }
private void ExportToExcelButton_OnClick(object sender, RoutedEventArgs e) { ExportToExcel.Export(ChangesHistoryDataGrid); }
private void uiImageButtonExport_Click(object sender, EventArgs e) { ExportToExcel.Export(uiDataGridView1, "Borrowed Book"); }
/// <summary> /// Método que generar un archivo excel a partir de la lista de documentos /// </summary> private async void getExcel() { DataSet ds = new DataSet(); //inicializamos objeto de Datatable DataTable table = new DataTable(); //Incializamos los servicios de dialog. DialogService dialog = new DialogService(); //Declaramos un objeto de tipo ProgressDialogController, el cual servirá para recibir el resultado el mensaje progress. ProgressDialogController Progress; //Si la lista de documentos contiene algún registro if (ListaDocumentos.Count != 0) { //Ejecutamos el método para enviar un mensaje de espera mientras el archivo de excel se genera Progress = await dialog.SendProgressAsync(StringResources.msgEspera, StringResources.msgGenerandoExcell); //Se añade las columnas, se especifíca el tipo fecha para dar formato a la columna //Se tien que especificar el tipo, si no la fecha se escribe mal en Excel table.Columns.Add("Numero de Documento"); table.Columns.Add("Descripción"); table.Columns.Add("Version"); table.Columns.Add("Fecha de Revisión", typeof(DateTime)); table.Columns.Add("Área"); table.Columns.Add("Tipo de Documento"); table.Columns.Add("Usuario Elaboró"); table.Columns.Add("Usuario Autorizó"); table.Columns.Add("Classification Level"); //Iteramos la lista de documentos foreach (var item in ListaDocumentos) { //Se crea una nueva fila DataRow newRow = table.NewRow(); //Se añaden los valores a las columnas newRow["Numero de Documento"] = item.nombre; newRow["Descripción"] = item.descripcion; newRow["Version"] = item.version.no_version; newRow["Fecha de Revisión"] = item.version.fecha_version; newRow["Área"] = item.Departamento; newRow["Tipo de Documento"] = item.tipo.tipo_documento; newRow["Usuario Elaboró"] = item.usuario; newRow["Usuario Autorizó"] = item.usuario_autorizo; newRow["Classification Level"] = item.version.ClassificationLevel.ClassificationLevel; //Agregamos la fila a la tabla table.Rows.Add(newRow); } //Se agrega la tabla al dataset ds.Tables.Add(table); //Ejecutamos el método para exportar el archivo string e = await ExportToExcel.Export(ds); //Si hay un error if (e != null) { //Cerramos el mensaje de espera await Progress.CloseAsync(); //Mostramos mensaje de error await dialog.SendMessage(StringResources.ttlAlerta, StringResources.msgErrorGenerarArchivo); } //Ejecutamos el método para cerrar el mensaje de espera. await Progress.CloseAsync(); } }
public override void OnClick() { if (m_Hook == null) { return; } if (m_Hook.MapControl == null) { return; } if (m_Hook.MapControl.Map == null) { return; } IMap pMap = m_Hook.MapControl.Map; if (pMap.LayerCount == 0) { return; } string strZLDJ = ""; IFeatureClass pZLDJFeaClass = null; string ZLDJLayerName = ""; SysCommon.ModSysSetting.CopyConfigXml(Plugin.ModuleCommon.TmpWorkSpace, "统计配置", ModQuery.m_StatisticsPath); //added by chulili 20111110先从业务库拷贝配置文件 try { //获取地名地物类 GeoDataCenterFunLib.ModQuery.GetPlaceNameStatisticsConfig(out pZLDJFeaClass, out ZLDJLayerName, out strZLDJ, "主导功能区分布"); if (pZLDJFeaClass == null) { MessageBox.Show("林地图斑数据,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (pZLDJFeaClass != null) { if (pZLDJFeaClass.FindField(strZLDJ) < 0) { MessageBox.Show("找不到林地图斑数据主导功能区属性,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); pZLDJFeaClass = null; return; } } frmSetStatistic pfrmSetStatistic = new frmSetStatistic(); if (pfrmSetStatistic.ShowDialog() == DialogResult.OK) { ExportToExcel pExportToExcel = new ExportToExcel(); IFeatureCursor pFeatureCursor = null; if (pfrmSetStatistic.bIsCheck) { if (pMap.SelectionCount == 0) { MessageBox.Show("请在当前地图上选择林地图斑数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //IFeatureLayer pFeatureLayer = GetLayerByName(ZLDJLayerName, pMap) as IFeatureLayer; //if (pFeatureLayer == null) //{ // MessageBox.Show("找不到林地图斑数据,请先加载该数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // return; //} //IFeatureSelection pFeatureSelection = pFeatureLayer as IFeatureSelection; //ISelectionSet pFeatSet = pFeatureSelection.SelectionSet; //pFeatSet.Search(null, true, out pCursor); //pFeatureCursor = pCursor as IFeatureCursor; IGeometry pGeo = ModDBOperate.GetSelectFeatureGeom(pMap); ISpatialFilter pSpatialFilter = new SpatialFilterClass(); pSpatialFilter.GeometryField = "SHAPE"; pSpatialFilter.Geometry = pGeo; pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; pFeatureCursor = pZLDJFeaClass.Search(pSpatialFilter, false); } else { pFeatureCursor = pZLDJFeaClass.Search(null, false); } pExportToExcel.Export(pZLDJFeaClass, pFeatureCursor, "主导功能区分布", "主导功能区", strZLDJ); System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor); } if (this.WriteLog) { Plugin.LogTable.Writelog("专题图统计-主导功能区统计");//ygc 2012-9-14 写日志 } } catch (Exception ex) { ErrorHandle.ShowFrmErrorHandle("提示", ex.Message); } }
//ექსელში გამოტანა private void ExportExcel_Click(object sender, EventArgs e) { ExportToExcel.Export(dgv1); }
/// <summary> /// Método que exporta el historial de lecciones aprendidas del componente seleccionado. /// </summary> private async void exportHistorialExcel() { DataSet ds = new DataSet(); DataTable table = new DataTable(); //Incializamos los servicios de dialog. DialogService dialog = new DialogService(); //Declaramos un objeto de tipo ProgressDialogController, el cual servirá para recibir el resultado el mensaje progress. ProgressDialogController Progress; //Ejecutamos el método para enviar un mensaje de espera mientras el documento se guarda. Progress = await dialog.SendProgressAsync(StringResources.msgDoingOperation, StringResources.msgGenerandoExcell); List <LeccionesAprendidas> Lista = DataManagerControlDocumentos.GetHistorialComponenteLeccionesAprendidas(AuxLeccionSeleccionada.COMPONENTE); //Si la lista de documentos es diferente de cero if (Lista.Count != 0) { //Se añade las columnas, se especifíca el tipo fecha para dar formato a la columna //Se tien que especificar el tipo, si no la fecha se escribe mal en Excel table.Columns.Add("Cambio Realizado Por"); table.Columns.Add("Componente"); table.Columns.Add("Descripción Problema"); table.Columns.Add("Fecha Actualización", typeof(DateTime)); table.Columns.Add("Reportado Por"); table.Columns.Add("Solicitud de Trabajo"); //Iteramos la lista de documentos foreach (var item in Lista) { //Se crea una nueva fila DataRow newRow = table.NewRow(); //Se añaden los valores a las columnas newRow["Cambio Realizado Por"] = item.NombreCompleto; newRow["Componente"] = item.COMPONENTE; newRow["Descripción Problema"] = item.DESCRIPCION_PROBLEMA; newRow["Fecha Actualización"] = item.FECHA_ACTUALIZACION; newRow["Reportado Por"] = item.REPORTADO_POR; newRow["Solicitud de Trabajo"] = item.SOLICITUD_DE_TRABAJO; //Agregamos la fila a la tabla table.Rows.Add(newRow); } //Se agrega la tabla al dataset ds.Tables.Add(table); //Ejecutamos el método para exportar el archivo string e = await ExportToExcel.Export(ds); if (e != null) { //Cerramos el mensaje de espera await Progress.CloseAsync(); //Mostramos mensaje de error await dialog.SendMessage(StringResources.msgError, StringResources.msgGenerandoExcell); } //Ejecutamos el método para cerrar el mensaje de espera. await Progress.CloseAsync(); } }