public void SaveAsCSV(CSVTable nDataTable, MemoryStream nCSVStream, bool nAutoTrim, bool nHasHeader, string nSeparator, string nTextQualifier) { this.TextQualifier = nTextQualifier; SaveAsCSV(nDataTable, nCSVStream, nAutoTrim, nHasHeader, nSeparator); }
internal CSVColumnList(CSVTable nTable) { this.ColumnsDictionary = new Dictionary <string, CSVColumn>(); this.ColumnsList = new List <CSVColumn>(); this.Table = nTable; }
public void SaveAsCSV(CSVTable nDataTable, MemoryStream nCSVStream, bool nAutoTrim, bool nHasHeader) { this.HasHeader = nHasHeader; SaveAsCSV(nDataTable, nCSVStream, nAutoTrim); }
public void SaveAsCSV(CSVTable nDataTable, string nCSVFile, bool nAutoTrim, bool nHasHeader, string nSeparator) { this.Separator = nSeparator; SaveAsCSV(nDataTable, nCSVFile, nAutoTrim, nHasHeader); }
public void SaveAsCSV(CSVTable nDataTable, string nCSVFile, bool nAutoTrim, bool nHasHeader) { this.HasHeader = nHasHeader; SaveAsCSV(nDataTable, nCSVFile, nAutoTrim); }
public void SaveAsCSV(CSVTable nDataTable, string nCSVFile, bool nAutoTrim) { SetupRegEx(); var sLine = ""; var sw = new StreamWriter(nCSVFile, false, this.SaveEncoding); if (this.HasHeader) { for (var iCol = 0; iCol < nDataTable.Columns.Count; iCol++) { if (!nDataTable.Columns[iCol].Export) { continue; } if (sLine.Length > 0) { sLine += this.Separator; } sLine += ExportFormat(nDataTable.Columns[iCol].ColumnTitle); } sw.WriteLine(sLine); } foreach (CSVRow dr in nDataTable.Rows) { sLine = ""; for (var iCol = 0; iCol < nDataTable.Columns.Count; iCol++) { if (!nDataTable.Columns[iCol].Export) { continue; } if (iCol > 0) { sLine += this.Separator; } if (dr[iCol] == null) { continue; } var Valor = ExportFormat(getValueFormated(dr[iCol], nDataTable.Columns[iCol].Format)); if (Valor.IndexOf(this.Separator) > -1) { sLine += this.TextQualifier + (nAutoTrim ? Valor.Trim() : Valor) + this.TextQualifier; } else { sLine += (nAutoTrim ? ExportFormat(Valor.Trim()) : Valor); } } sw.WriteLine(sLine); } sw.Flush(); sw.Close(); }
internal CSVRowList(CSVTable nTable) { this.Rows = new List <CSVRow>(); this.Table = nTable; }