Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Created Unassigned: Make ExcelDataValidation.Formula1 Public [15529]

$
0
0
In order to get the values from a drop-down menu I need to read the currently protected ExcelDataValidation.Formula1 parameter that contains the refference to the NamedRange.

So can you plase make ExcelDataValidation.Formula1 Public?

I got around this by reading the value from the WorksheetXml, but it's not pretty:

```
var cell = ws.Cells[1, 1];
var DataValidation = ws.DataValidations[cell.Address];
if (DataValidation != null)
{
field.Tooltip = DataValidation.Prompt;
//field.Formula1 = DataValidation.Formula1; //Protected parameter, read from WorksheetXml below

var nsmgr = new XmlNamespaceManager(ws.WorksheetXml.NameTable);
nsmgr.AddNamespace("ns", ws.WorksheetXml.SelectSingleNode("*").NamespaceURI);
var dataValidation = ws.WorksheetXml.SelectSingleNode("//ns:dataValidation[@sqref='" + DataValidation.Address.Address + "']", nsmgr);
string rangeName = null;
if (dataValidation != null) {
var formula1 = dataValidation.SelectSingleNode("ns:formula1", nsmgr);
if (formula1 != null)
rangeName = formula1.InnerText;
}
```

Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>