Execl es muy poderoso, y muchas funciones o fórmulas incorporadas pueden mejorar en gran medida la capacidad de procesamiento de los datos. Entonces, ¿hay controles similares en la web? Después de alguna búsqueda, descubrí que Handable tiene fórmulas de soporte de función de Excel básica y puede editar datos en tiempo real. Además, admite la copia de arrastre, Ctrl+C, Ctrl+V, etc. En términos de soporte de navegador, admite los siguientes navegadores: IE7+, FF, Chrome, Safari, Opera.
Primero, se introducen los archivos de biblioteca relevantes. El soporte de la fórmula no está incluido en el full.js y debe introducirse por separado:
<script src = "http://handsontable.github.io/handsontable-rulejs/lib/jquery/jquery-1.10.2.js"> </script> <script src = "http://handsontable.github.io/handsontable-ruljs/lib/handsontable rel = "Stylesheet" Media = "Screen" href = "http://handsontable.github.io/handsontable-rulejs/lib/handsontable/handsontable.full.css"> <script src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/lodash/lodash.js"> </script> <script src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/underscore.string/underscore.string.js"> </script> <script src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/moment/moment.js"> </script> <script src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/moment/moment.js"> </script> <script src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/numeral/numeral.js"> </script> <script src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/numericjs/numeric.js"> </script> <script src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/js-md5/md5.js"> </script> <script src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/js-md5/md5.js"> </script> <script src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/jstat/jstat.js"> </script> <script src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/par/par/par src = "http://handSontable.github.io/handsontable-rulejs/lib/rulejs/js/parser.js"> </script> <script src = "http://handsontable.github.io/sontable-rulejs/lib/rulejs/js/parser.jser.jser src = "http://handSontable.github.io/handsonSontable-rulejs/lib/rulejs/js/rulejs.js"> </script> <script src = "http://handsontable.github.io/handSontable-ruls.js/lib/handsontable
Coloque un contenedor DIV en HTML para almacenar el control manso:
<body> <div id = "Code de consejos"> </div> </body>
En el código JavaScript, primero obtenga el contenedor DIV y luego cree el control de la tabla:
<script type="text/javascript"> $(document).ready(function () { var data1 = [ ['=$B$2', "Maserati", "Mazda", "return 1+2;", 'return DataAccess.getScalar("select top 1 name from Cloud_Users where cellPhone=15895211486");', "=A$1"], [2009, 0, 2941, 4303, 354, 5814], [2010, 5, 2905, 2867, '= sum (a4, 2, 3)', '= $ b1'], [2011, 4, 2517, 4822, 552, 6127], [2012, '= sum (A2: A5)', '= sum (B5, E3)', '= B2/, 12, 12', 12 ', 12', 12, 12/, 12 ', 12, 12', 12, 12, 12, 12, 12, 12/, 12, 12/, 12, 12, 12, 12, 12, 12/, 12/, 12, 12, 12, 12, 12/, 12, 12/, 12/, 12, 12/, 12/, 12. 4151]]; //cellproperties.readonly = true; // Devuelve el tipo de datos del formato: "html", // "xml", "html", "script", "json", "jsonp", "text". $ ("#msg"). html (decodeuri (data)); // HidELOADING (); td.appendChild (newValue); negativoValuerenderer); Handable.helper.Stringify (this.instance.getData () [fila] [col]); </script>La fórmula de = suma (B5, E3) es proporcionada por regidos. Return 1+2 es un script de código C# implementado por usted mismo. Debe hacer clic para analizar:
clase pública csEngine: ihttphandler {private static int count = 0; Public void ProcessRequest (httpContext context) {context.response.contentType = "text/Plain"; intente {count ++; cadena ret = ""; cadena código = context.request ["código"]. toString (); if (String.ISNULLOREMPTY (CODE)) {Ret = "Error de parámetro"; } else {scriptoptions options = scriptOptions.default .addreferences (ensamblaje.getAsembly (typeof (dbservices.dataAccess)) //.addimports("system.data ") //.addimports("System.Data.sqlclient") .addimortes estado var = csharpscript.runasync (código, opciones) .result.returnValue; ret = state.ToString (); estado = nulo; opciones = nulo; } Console.WriteLine (Count); context.Response.Write (ret); } catch (excepción ex) {// Error console.WriteLine (Count); }} public bool isreusable {get {return false; }}}Ejecute el código de la siguiente manera:
Lo anterior es todo el contenido de este artículo. Espero que sea útil para el aprendizaje de todos y espero que todos apoyen más a Wulin.com.