jueves, 9 de noviembre de 2017

Agregar validación de lista a celda de excel desde lista de SQL ADDIN VSTO

Validation.Add Method (Excel) add-in VSTO
Agregar lista de validación a Excel desde base de datos
Agrega validación de datos al rango especificado

   string Clientes = string.Empty;//"[Seleccione un Cliente...]"; 
            ClienteIncortemList oClienteIncortemList = new ClienteIncortemList();//obteto tipo lista de clientes
            ConfigurationOperation.GetClienteIncortemByAll(oClienteIncortemList);//metodo que trae a clientes de base de datos
            foreach (ClienteIncortem oClienteIncortem in oClienteIncortemList.lstClienteIncortem) //itera la lista para formar una cadena separada por comas
            {
                Clientes += Clientes == string.Empty ? "" : ",";
                Clientes += oClienteIncortem.cvCliente + " - " + oClienteIncortem.nbCliente.Replace(',', ' ');
            }


            wrksh.get_Range("B11:B11", System.Type.Missing).Validation.Add(XlDVType.xlValidateList, System.Type.Missing, XlFormatConditionOperator.xlBetween, Clientes, System.Type.Missing); // VALDACION DE LISTA

No hay comentarios:

Publicar un comentario

Comenta cualquier duda o recomendatorio.