Reading more than 255 characters from excel

前端 未结 2 638
天涯浪人
天涯浪人 2021-01-24 17:01

I am trying to read a sheet data from excel (tried both oldedb and odbc) and found out that there is 255 characters limit. I tried using Range object as suggested

相关标签:
2条回答
  • 2021-01-24 17:52

    Since the issue is with the Jet Provider, why not try the Microsoft Excel Driver listed under ODBC connctions.

    Source

    0 讨论(0)
  • 2021-01-24 17:53

    below code work for me. import data from excel (.xls & .xlsx) file (work for column value more than 255 character).

    using Excel;
    
            try
            {
                FileStream stream = File.Open(strFilePath, FileMode.Open, FileAccess.Read);
                IExcelDataReader excelReader = null;
                if (extension.Trim() == ".xls")
                {
                    excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
                }
                else if (extension.Trim() == ".xlsx")
                {
                    excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
                }
                excelReader.IsFirstRowAsColumnNames = true;
                DataSet result = excelReader.AsDataSet();
    
                excelReader.Close();
            }
            catch (Exception err)
            {
                mResult.Message = err.Message;
            }
    

    Download nuget packages: 1) PCLStorage (Version: 1.0.2) 2) ExcelDataReader-DevNet45 (version: 1.0.0.2)

    Code reference

    0 讨论(0)
提交回复
热议问题