DataValidation from range on other sheet

I'm trying to add Data Validation to a cell in a worksheet. However, that Data Validation is a formula that references another sheet in the workbook.

In Excel, the Data Validation looks like this:

Essentially it's:
Allow: List
Source: =Other_Worksheet!$A$22:$A$37

I can't seem to make this work in XlsIO.  Is it not supported?  I don't want to hard-code the list of values in my application if I can avoid it.

The code I'm doing so far:

var assessmentPhaseValidation = vulnsTab.Range["A1:A" + (row - 1)].DataValidation;

assessmentPhaseValidation.AllowType = ExcelDataType.User;

assessmentPhaseValidation.PromptBoxText = "Data Validation List";

assessmentPhaseValidation.IsPromptBoxVisible = true;

assessmentPhaseValidation.ShowPromptBox = true;


However, when I do that, it strips off the other sheet name, making the validation in the current sheet (which doesn't work).


3 Replies

MA Matt Andreko January 19, 2013 04:06 PM UTC

Sorry, I missed a line.  Pretend that this line was also in the above source:

assessmentPhaseValidation.FirstFormula = "=Criticality_Overview!$A$22:$A$37";



MA Matt Andreko January 21, 2013 08:31 PM UTC

For anyone else that has issues, I made it work like this:

var assessmentPhaseValidation = vulnsTab.Columns[0].DataValidation;

 assessmentPhaseValidation.DataRange = vulnsTab.Workbook.Worksheets["Criticality_Overview"].Range["A22:A37"];


In addition to that, I also had to have this enabled on the workbook:

workbook.Allow3DRangesInDataValidation = true;



SR Sridhar Syncfusion Team January 22, 2013 10:21 AM UTC

Hi Matt,

Thank you for using Syncfusion products.

We are glad to know the above reported issue is resolved at your end.

If you still face the issue, please get back to us with issue reproducing sample with excel template to proceed further.

Please let me know if you require any further clarifications.

Regards,
Sridhar.S

Loader.
Up arrow icon