error in excel data from a csv with epplus

0

I have a csv file that has as one of its data 829/10/17 and using epplus to convert to excel it changes to this data -390883 although I force the column to type text, and probe also in perzonalidad and general and keep doing it, could you help me?

eye is not a date type, it is a string and in that column the data will not always come that way. that is, it can come without the bars.

   string excelFileName = rutasalida + "Resultado " + fechafilename + "-" + horatotalfilename + ".xlsx";


        string worksheetsName = "Hoja1";

        bool firstRowIsHeader = false;

        var format = new ExcelTextFormat();
        format.Culture = new CultureInfo("es-ES");
        format.Delimiter = ';';
        format.EOL = "\n";
        format.Encoding = new UTF8Encoding();
       // format.DataTypes = new eDataTypes[] { eDataTypes.Number, eDataTypes.String };



        format.SkipLinesEnd = 1;



        using (ExcelPackage package = new ExcelPackage(new FileInfo(excelFileName)))
        {


            ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(worksheetsName);
            worksheet.DefaultColWidth = 20;
            worksheet.Cells["A1:BI"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;

            worksheet.Cells["N:N"].Style.Numberformat.Format = "0.00";
            worksheet.Cells["W:W"].Style.Numberformat.Format = "@";


            worksheet.Cells["AD:AD"].Style.Numberformat.Format = "0.00";
            worksheet.Cells["AF:AF"].Style.Numberformat.Format = "0.00";
            worksheet.Cells["AL:AL"].Style.Numberformat.Format = "0.00";
            worksheet.Cells["AN:AN"].Style.Numberformat.Format = "0.00";
            worksheet.Cells["AS:AS"].Style.Numberformat.Format = "0.00";
            worksheet.Cells["AU:AU"].Style.Numberformat.Format = "0.00";
            worksheet.Cells["BA:BA"].Style.Numberformat.Format = "0.00";
            worksheet.Cells["BB:BB"].Style.Numberformat.Format = "0.00";
            worksheet.Cells["BF:BF"].Style.Numberformat.Format = "0.00";

            worksheet.Cells["J:J"].Style.Numberformat.Format = DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
            worksheet.Cells["k:k"].Style.Numberformat.Format = DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
            worksheet.Cells["L:L"].Style.Numberformat.Format = DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
            worksheet.Cells["M:M"].Style.Numberformat.Format = DateTimeFormatInfo.CurrentInfo.ShortDatePattern;

            worksheet.Cells["A1"].LoadFromText(new FileInfo(csvFileName), format, OfficeOpenXml.Table.TableStyles.None, firstRowIsHeader);

            package.Save();

        }
    
asked by AL TJ 31.10.2017 в 06:38
source

0 answers