O EXECL é muito poderoso, e muitas funções ou fórmulas internas podem melhorar bastante a capacidade de processamento dos dados. Então, existem controles semelhantes na web? Após algumas pesquisas, descobri que o HandsOntable possui fórmulas básicas de suporte à função do Excel e pode editar dados em tempo real. Além disso, ele suporta cópia de arrasto, Ctrl+C, Ctrl+V, etc. Em termos de suporte ao navegador, suporta os seguintes navegadores: IE7+, FF, Chrome, Safari, Opera.
Primeiro, os arquivos de biblioteca relevantes são introduzidos. O suporte da fórmula não está incluído no HandsOntable.full.js e precisa ser introduzido separadamente:
<script src = "http://handsontable.github.io/handsontable-rulejs/lib/jquery/jquery-1.10.2.js"> </sCript> <script src = "http://handsontable.github.io/handsontable-rulejs/lib/handsontable/handsontable.full.js"> </sCript> <link 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/undercore.string/undercore.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/lib/parser.js"> </script> <script src = "http://handsontable.github.io/handsontablejs/llib.rlejursjurtjursjits src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/js/parser.js"> </script> <script src = "http://handsolable.github.io/handsontable.sjs/librp://handsontable.github.io/handsOntable.sjs/librp:/rlejs.github.indsontable.sjs/librp:/rlejs.github.indsontable.sjs/librp/rlejsjs.rulejsrlejs.rlejs/rulejsingjursing src = "http://handsontable.github.io/handsontable-rulejs/lib/handsontable/handsontable.formula.js"> </sCript>
Coloque um contêiner de div em HTML para armazenar o controle Handsontable:
<Body> <div id = "HandsOntable-Code"> </div> </body>
No código JavaScript, primeiro obtenha o contêiner Div e depois crie o controle da tabela:
<script type = "text/javascript"> $ (document) .ready (function () {var data1 = [['= $ b $ 2', "maserati", "mazda", "return 1+2;", return DataAccess.getScalar ("selecione Top 1 Name de nuvem_USERS WHEREN = 1589521148" " 2941, 4303, 354, 5814], [2010, 5, 2905, 2867, '= soma (A4, 2, 3)', '= $ b1'], [2011, 4, 2517, 4822, 552, 6127], [2012, = soma (a2: a5) '', '' = 3, B127, [2012, 4, 2517, 4822, 552, 6127], [2012, '= soma (a2: a5)' ',' '' = 3, B127, [2012,/soma (A2), 4822. 4151]]; //CellProperties.readonly = true; // Retorne dados do formato de dados: "html", // "xml", "html", "script", "json", "jsonp", "text". $ ("#msg"). html (decodeuri (dados)); // hideloading (); TD.AppendChild (NewValue); negativovaluerenderer); Handsontable.Helper.Stringify (This.instance.getData () [ROW] [Col]); </script>A fórmula de = SUM (B5, E3) é fornecida pelo Regulamentojs. Retornar 1+2 é um script de código C# implementado por você mesmo. Você precisa clicar para analisar:
classe pública Csengine: ihttphandler {private static int conting = 0; public void ProcessRequest (contexto httpContext) {Context.Response.ContentType = "Text/Plain"; tente {count ++; string ret = ""; string code = context.request ["code"]. tostring (); if (string.isNullorEmpty (code)) {ret = "Erro do parâmetro"; } else {ScriptOptions options = scriptOptions.default .addReferences (Assembly.GetasEMBLY (typeof (dbServices.dataacccess))) //.addimports("system.data ") //.addimports("data.data.sqlcient"). var estado = csharpscript.runasync (código, opções) .result.returnValue; ret = state.toString (); estado = nulo; opções = nulo; } Console.WriteLine (contagem); context.Response.Write (RET); } catch (Exceção ex) {// Erro Console.WriteLine (contagem); }} public bool isreusable {get {return false; }}}Execute o código da seguinte forma:
O exposto acima é todo o conteúdo deste artigo. Espero que seja útil para o aprendizado de todos e espero que todos apoiem mais o wulin.com.