Completed
Last Updated: 11 Mar 2022 19:40 by Beth
Helen
Created on: 13 May 2020 13:43
Category: Spreadsheet
Type: Bug Report
1
Export spreadsheet has an error when there's validation in cell
7 comments
Beth
Posted on: 11 Mar 2022 19:40
Placing the values in a separate sheet is a great solution! Thank you for the recommendation. It's working very well now including support for validation after exporting to Excel. 
ADMIN
Peter Milchev
Posted on: 09 Mar 2022 15:03

Hello Beth,

Thank you for sharing the reason behind the issue you have encountered. 

As an alternative, the values can be added in a separate sheet and the validation to point to a range instead of a hardcoded string.

Regards,
Peter Milchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Beth
Posted on: 09 Feb 2022 20:18

My apologies for the second post. The solution I listed below does not work. The actual problem is that Excel has a 256-character limit on data validation lists that are entered as a string (as opposed to validations sourced from elsewhere in a spreadsheet). Source

If the From string exceeds 256 characters, an error message will appear on export.

Beth
Posted on: 09 Feb 2022 16:48

Hello, I found the cause of my problem and will post it here if it helps others. 

I have a RadSpreadsheet that uses a custom database provider. The spreadsheet has many columns that use a custom editor to provide a drop-down list of selections. The drop-down list is generated from a generic list (from a database). In the below sample code, _fundCodes is a List<FundCode>. 

When I create the column like this, I will see validation error messages when exporting to Excel:

                     

 _columns.Add(new MyColumn()
     {
          Name = "FundCode",
          DisplayName = "FundCode",
          Validation = new Validation()
                    {
                        AllowNulls = true,
                        DataType = "list",
                        ShowButton = true,
                        ComparerType = "list",
  From = "\"" + string.Join(",", _fundCodes.Select(item => item.FundName).ToArray()) + "\"",
                                              Type = "reject"
                    }
                });

 

However, if I move the construction of my comma-delimited list outside this statement, no validation error will appear in Excel and Excel even displays the drop down options (which is awesome):

string strFundCodes = "\"" + string.Join(",", _fundCodes.Select(item => item.FundName).ToArray()) + "\"";
                _columns.Add(new MyColumn()
                {
                    Name = "FundCode",
                    DisplayName = "FundCode",
                    Validation = new Validation()
                    {
                        AllowNulls = true,
                        DataType = "list",
                        ShowButton = true,
                        ComparerType = "list",                     
                        From = strFundCodes,
                        Type = "reject"
                    }
                });

 

ADMIN
Peter Milchev
Posted on: 09 Feb 2022 09:41

Hello Beth,

Please verify the Validation is properly formatted depending on the coding language you use. The shared online demo is updated and the validation is working properly. 

If you still have issues, please open a support ticket where you share your spreadsheet configuration and code files and we can review them and provide more specific suggestions to overcome the problem.

Regards,
Peter Milchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Beth
Posted on: 02 Feb 2022 18:33
Hello, I am encountering the same problem and this solution did not make a difference. Is this answer still correct? 
ADMIN
Peter Milchev
Posted on: 11 Jun 2020 16:18

Hello Helen,

The Validation's From property for the list can be set as a stringified JSON object and it works on the web page. 

Nevertheless, this is not a valid format for the Excel files, so the validation from the demo needs to be changed to be a simple string:

C#

        secondCell.Validation = new Validation()
        {
            AllowNulls = true,
            DataType = "list",
            ShowButton = true,
            ComparerType = "list",
            From = "\"Foo item 1,Bar item 2,Baz item 3\"",
            Type = "reject"
        };

VB

 secondCell.Validation = New Validation() With {
            .AllowNulls = True,
            .DataType = "list",
            .ShowButton = True,
            .ComparerType = "list",
            .From = """Foo item 1,Bar item 2,Baz item 3""",
            .Type = "reject"
        }

Regards,
Peter Milchev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.