protected override void Execute(CodeActivityContext context) { var excelpath = ExcelPath.Get(context); var pageindex = SheetIndex.Get(context); var txtpath = TxtPath.Get(context); var splitchar = SplitChar.Get(context); var addheaders = AddHeaders.GetType(); Workbook wb = new Workbook(); wb.LoadFromFile(@excelpath); Worksheet ws = wb.Worksheets[pageindex]; DataTable dt = ws.ExportDataTable(); //TXT VARSA İÇİNİ TEMİZLE if (File.Exists(txtpath)) { File.WriteAllText(txtpath, ""); } //BAŞLIK if (AddHeaders) { string[] columnNames = dt.Columns.Cast <DataColumn>().Select(x => x.ColumnName).ToArray(); File.AppendAllText(@txtpath, string.Join(splitchar, columnNames) + Environment.NewLine); } //SATIRLAR foreach (DataRow dtR in dt.Rows) { File.AppendAllText(@txtpath, string.Join(splitchar, dtR.ItemArray) + Environment.NewLine); } }
private IncludeProperties RemoveIfExit(IList <string> names, string name) { var theOne = TryFindIt(names, name); if (string.IsNullOrWhiteSpace(theOne)) { return(this); } names.Remove(theOne); Properties = string.Join(SplitChar.ToString(), names); return(this); }
public override string ToString() { return($"Current sc: {SplitChar.ToString()} -> L: {LowNode?.SplitChar ?? '#'} , E: {EqNode?.SplitChar ?? '#'} H: {HiNode?.SplitChar ?? '#'}"); }