/// <summary>Reads a Csv File and return their contents as DataTable</summary>
 /// <param name="filename">The file to read.</param>
 /// <param name="options">The options used to create the record mapping class.</param>
 /// <returns>The contents of the file as a DataTable</returns>
 public static DataTable CsvToDataTable(string filename, CsvOptions options)
 {
     var engine = new CsvEngine(options);
     return engine.ReadFileAsDT(filename);
 }
Beispiel #2
0
 /// <summary>Reads a Csv File and return their contents as DataTable</summary>
 /// <param name="classname">The name of the record class</param>
 /// <param name="delimiter">The delimiter for each field</param>
 /// <param name="filename">The file to read.</param>
 /// <param name="hasHeader">Indicates if the file contains a header with the field names.</param>
 /// <returns>The contents of the file as a DataTable</returns>
 public static DataTable CsvToDataTable(string filename, string classname, char delimiter, bool hasHeader)
 {
     return(CsvEngine.CsvToDataTable(filename, classname, delimiter, hasHeader));
 }
Beispiel #3
0
 /// <summary>Reads a Csv File and return their contents as DataTable</summary>
 /// <param name="filename">The file to read.</param>
 /// <param name="options">The options used to create the record mapping class.</param>
 /// <returns>The contents of the file as a DataTable</returns>
 public static DataTable CsvToDataTable(string filename, CsvOptions options)
 {
     return(CsvEngine.CsvToDataTable(filename, options));
 }
Beispiel #4
0
 /// <summary>Reads a Csv File and return their contents as DataTable (The file must have the field names in the first row)</summary>
 /// <param name="delimiter">The delimiter for each field</param>
 /// <param name="filename">The file to read.</param>
 /// <returns>The contents of the file as a DataTable</returns>
 public static DataTable CsvToDataTable(string filename, char delimiter)
 {
     return(CsvEngine.CsvToDataTable(filename, delimiter));
 }
Beispiel #5
0
 /// <summary>Simply dumps the DataTable contents to a delimited file. Only allows to set the delimiter.</summary>
 /// <param name="dt">The source Data Table</param>
 /// <param name="filename">The destination file.</param>
 /// <param name="options">The options used to write the file</param>
 public static void DataTableToCsv(DataTable dt, string filename, CsvOptions options)
 {
     CsvEngine.DataTableToCsv(dt, filename, options);
 }
Beispiel #6
0
 /// <summary>Simply dumps the DataTable contents to a delimited file. Only allows to set the delimiter.</summary>
 /// <param name="dt">The source Data Table</param>
 /// <param name="filename">The destination file.</param>
 /// <param name="delimiter">The delimiter used to write the file</param>
 public static void DataTableToCsv(DataTable dt, string filename, char delimiter)
 {
     CsvEngine.DataTableToCsv(dt, filename, new CsvOptions("Tempo", delimiter, dt.Columns.Count));
 }
Beispiel #7
0
 /// <summary>Simply dumps the DataTable contents to a delimited file using a ',' as delimiter.</summary>
 /// <param name="dt">The source Data Table</param>
 /// <param name="filename">The destination file.</param>
 public static void DataTableToCsv(DataTable dt, string filename)
 {
     CsvEngine.DataTableToCsv(dt, filename);
 }
Beispiel #8
0
        /// <summary>Reads a Csv File and return their contents as DataTable</summary>
        /// <param name="filename">The file to read.</param>
        /// <param name="options">The options used to create the record mapping class.</param>
        /// <returns>The contents of the file as a DataTable</returns>
        public static DataTable CsvToDataTable(string filename, CsvOptions options)
        {
            var engine = new CsvEngine(options);

            return(engine.ReadFileAsDT(filename));
        }