/// <summary> /// Stop Exporting /// </summary> /// <param name="exportDataTableArgs">ExportDataTableEventArgs</param> private void Sheet_ExportDataTableEventStop(ExportDataTableEventArgs exportDataTableArgs) { if (exportDataTableArgs.ExcelValue != null && exportDataTableArgs.ExcelValue.ToString() == "BLONP") { exportDataTableArgs.ExportDataTableAction = ExportDataTableActions.StopExporting; } }
/// <summary> /// Replace value /// </summary> /// <param name="exportDataTableArgs">ExportDataTableEventArgs</param> private void Sheet_ExportDataTableEventReplace(ExportDataTableEventArgs exportDataTableArgs) { if (exportDataTableArgs.ExcelValue != null && exportDataTableArgs.ExcelValue.ToString() == "México D.F.") { exportDataTableArgs.DataTableValue = "Mexico"; } }
/// <summary> /// Skip Row /// </summary> /// <param name="exportDataTableArgs">ExportDataTableEventArgs</param> private void Sheet_ExportDataTableEventSkip(ExportDataTableEventArgs exportDataTableArgs) { if (exportDataTableArgs.ExcelColumnIndex == 4 && exportDataTableArgs.ExcelValue.ToString() == "Owner") { exportDataTableArgs.ExportDataTableAction = ExportDataTableActions.SkipRow; } }
private static void ExportDataTable_EventAction(ExportDataTableEventArgs e) { if (e.ExcelValue != null && e.ExcelValue.ToString() == "Owner") { //Skips the row to export into the data table if the Excel cell value is “Owner” e.ExportDataTableAction = ExportDataTableActions.SkipRow; } else if (e.DataTableColumnIndex == 0 && e.ExcelRowIndex == 5 && e.ExcelColumnIndex == 1) { //Stops the export based on the condition e.ExportDataTableAction = ExportDataTableActions.StopExporting; } else if (e.ExcelValue != null && e.ExcelValue.ToString() == "Mexico D.F.") { //Replaces the cell value in the data table without affecting the Excel document. e.DataTableValue = "Mexico"; } }
/// <summary> /// Export dataTable required actions. /// </summary> /// <param name="e"></param> private void ExportDataTableEventActions(ExportDataTableEventArgs e) { if (this.rdbSkipRow.Checked) { if (e.ExcelValue != null && e.ExcelValue.ToString() == "Owner") { e.ExportDataTableAction = ExportDataTableActions.SkipRow; } } if (this.rdbStop.Checked) { if (e.ExcelValue != null && e.ExcelValue.ToString() == "CACTU") { e.ExportDataTableAction = ExportDataTableActions.StopExporting; } } if (this.rdbReplaceValue.Checked) { if (e.ExcelValue != null && e.ExcelValue.ToString() == "Mexico D.F.") { e.DataTableValue = "Mexico"; } } }
/// <summary> /// Export dataTable required actions. /// </summary> /// <param name="e"></param> private void ExportDataTableEventActions(ExportDataTableEventArgs e) { if (importOptions == "Skip") { if (e.ExcelValue != null && e.ExcelValue.ToString() == "Owner") { e.ExportDataTableAction = ExportDataTableActions.SkipRow; } } if (importOptions == "Stop") { if (e.ExcelValue != null && e.ExcelValue.ToString() == "CACTU") { e.ExportDataTableAction = ExportDataTableActions.StopExporting; } } if (importOptions == "Replace") { if (e.ExcelValue != null && e.ExcelValue.ToString() == "México D.F.") { e.DataTableValue = "Mexico"; } } }