0

I'm using EEPLUS to export a preformated-excel using for that DataValidation Lists, but I'm getting Error in a large List, here is the code:

        ExcelPackage pck = new ExcelPackage();
        var ws = pck.Workbook.Worksheets.Add("Testing");

        ws.Cells["A1"].Value = "Column A";
        ws.Cells["B1"].Value = "Column B";
        ws.Cells["C1"].Value = "Column C";
        ws.Cells["A1:C1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
        ws.Cells["A1:C1"].Style.Fill.BackgroundColor.SetColor(Color.FromArgb(184, 204, 228));
        ws.Cells["A1:C1"].Style.Font.Bold = true;

        var val = ws.DataValidations.AddListValidation("B2:B10000");
        val.ShowErrorMessage = true;
        val.Formula.Values.Add("Add");
        val.Formula.Values.Add("Delete");

        var val2 = ws.DataValidations.AddListValidation("C2:C10000");
        val2.ShowErrorMessage = true;
        foreach (var student in classroomDictionary) val2.Formula.Values.Add(student["Name"]);

        Response.BinaryWrite(pck.GetAsByteArray());
        Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
        Response.AddHeader("Content-Disposition", String.Format("attachment; filename=etiquetas-{0}.xlsx", DateTime.Now.ToString("ddMMyyyy")));

As you can see, I'm creating 3 columns where the 2nd and 3r with DataValidation ListValidation. The 2nd column works great, but the 3r which I'm adding 200 items creates the Excel Workbook but I'm getting an error when I'm trying to oppening. There is a limitation for the numbers of items? Is a Excel limitation or EEPLUS limitation or is a problem with my code? In english something like: Excel found content that cannot be reading in... Do you want to recover the book content?...

In english sais something like: Excel found content that cannot be reading in... Do you want to recover the book content?...

Thank you BR

Santiago
  • 2,190
  • 10
  • 30
  • 59
  • _What_ error do you get? – Tim Schmelter Feb 27 '13 at 19:15
  • I put the Excel error message in the post, is in spanish sorry, I tried to translate it. Tks – Santiago Feb 27 '13 at 19:32
  • What happens if you click "Si"? Does it work, do you get details what went wrong, what features were removed? – Tim Schmelter Feb 27 '13 at 19:36
  • Opens the Excel saying "featured removed data validation" and no lists in the excel worksheet. But If I comment the "val2" code and try again, the excel open correctly with the first validation list also correctly and no error messages. – Santiago Feb 27 '13 at 19:40

0 Answers0