Ejemplo n.º 1
0
        public static System.Data.DataSet ImportExcelData(ImportType importType, string fileName, bool firstRowContainsHeaders, string worksheetName, string startRange, string endRange)
        {
            string          sql        = String.Format(SELECT_SQL, "*", "[" + worksheetName + startRange + ":" + endRange + "]");
            ExcelProperties properties = new ExcelProperties(firstRowContainsHeaders, true, importType == ImportType.CSV);

            return(ExcelUtility.Fill(fileName, sql, null, properties));
        }
Ejemplo n.º 2
0
        public static System.Data.DataSet ImportCSVData(string fileName, bool firstRowContainsHeaders)
        {
            string          sql        = String.Format(SELECT_SQL, "*", "[" + GetFileName(fileName) + "]");
            ExcelProperties properties = new ExcelProperties(firstRowContainsHeaders, true, true);

            return(ExcelUtility.Fill(fileName, sql, null, properties));
        }
Ejemplo n.º 3
0
        public static System.Data.DataSet ImportExcelData(ImportType importType, string fileName, bool firstRowContainsHeaders, string worksheetName, string[] columns)
        {
            string selectColumns = string.Empty;

            for (int i = 0; i < columns.Length; i++)
            {
                if (i == 0)
                {
                    selectColumns = columns[i];
                }
                else
                {
                    selectColumns += "," + columns[i];
                }
            }

            if (selectColumns.Trim() == string.Empty)
            {
                selectColumns = "*";
            }

            string sql = String.Format(SELECT_SQL, selectColumns, "[" + worksheetName + "]");

            ExcelProperties properties = new ExcelProperties(firstRowContainsHeaders, true, importType == ImportType.CSV);

            return(ExcelUtility.Fill(fileName, sql, null, properties));
        }
Ejemplo n.º 4
0
 public static void ExportToExcel(string destinationFileName, System.Data.DataSet dataSet, string worksheetName)
 {
     ExcelUtility.Export(dataSet.Tables[0], destinationFileName, worksheetName, null);
 }