Execl มีประสิทธิภาพมากและฟังก์ชั่นหรือสูตรในตัวจำนวนมากสามารถปรับปรุงความสามารถในการประมวลผลของข้อมูลได้อย่างมาก มีการควบคุมที่คล้ายกันในเว็บหรือไม่? หลังจากการค้นหาบางอย่างฉันพบว่า HanderNetable มีสูตรสนับสนุนฟังก์ชั่น Excel พื้นฐานและสามารถแก้ไขข้อมูลแบบเรียลไทม์ได้ นอกจากนี้ยังรองรับ Drag Copy, Ctrl+C, Ctrl+V ฯลฯ ในแง่ของการสนับสนุนเบราว์เซอร์รองรับเบราว์เซอร์ต่อไปนี้: IE7+, FF, Chrome, Safari, Opera
ขั้นแรกมีการแนะนำไฟล์ไลบรารีที่เกี่ยวข้อง การสนับสนุนสูตรไม่รวมอยู่ใน handernatable.full.js และจำเป็นต้องมีการแนะนำแยกต่างหาก:
<script src = "http://handnontable.github.io/handsontable-rulejs/lib/jquery/jquery-1.10.2.js"> </script> <script src = "http://handsontable.github.io/handsontable-rulejs rel = "stylesheet" media = "หน้าจอ" href = "http://handsontable.github.io/handsontable-rulejs/lib/handsontable/handsontable.full.css" src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/lodash/lodash.js"> </script> <สคริปต์ src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/underscore.string/underscore.string.js"> </script> <สคริปต์ src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/moment/moment.js"> </script> <สคริปต์ src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/moment/moment.js"> </script> <สคริปต์ src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/numeral/numeral.js"> </script> <สคริปต์ src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/numericjs/numeric.js"> </script> <สคริปต์ src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/js-md5/md5.js"> </script> <สคริปต์ src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/js-md5/md5.js"> </script> <สคริปต์ src = "http://handsontable.github.io/handsontable-rulejs/lib/rulejs/lib/jstat/jstat.js"> </script> <script src = "http://handsontable.github.io/handsontable-rulejs src = "http://handnontable.github.io/handsontable-rulejs/lib/rulejs/js/parser.js"> </script> <script src = "http://handsontable.github.io/handsonstable-rulejs src = "http://handnontable.github.io/handsontable-rulejs/lib/rulejs/js/rulejs.js"> </script> <script src = "http://handsontable.github.io/handsontable-rulejs
ใส่ภาชนะ DIV ใน HTML เพื่อเก็บการควบคุมแบบ handontable:
<body> <div id = "handontable-code"> </div> </body>
ในรหัส JavaScript ก่อนอื่นรับคอนเทนเนอร์ DIV จากนั้นสร้างการควบคุมตาราง:
<script type = "text/javascript"> $ (เอกสาร) .ready (function () {var data1 = [['= $ b $ 2', "maserati", "mazda", "return 1+2;", 'return dataaccess.getScalar 2941, 4303, 354, 5814], [2010, 5, 2905, 2867, '= sum (A4, 2, 3)', '= $ b1'], [2011, 4, 2517, 4822, 552, 6127] 4151]]; ฟังก์ชั่น negativevaluerenderer (อินสแตนซ์, td, แถว, col, prop, ค่า, cellproperties) {handery.render.textrenderer.apply (นี้, rectond-iside //cellproperties.readonly = true; td.style.background = '#eee'; // ส่งคืนข้อมูลรูปแบบข้อมูล: "html", // "xml", "html", "สคริปต์", "json", "jsonp", "ข้อความ" $ ("#msg"). html (decodeuri (ข้อมูล); }, // เรียกฟังก์ชั่นที่เรียกใช้งาน: ฟังก์ชั่น () {// การร้องขอการจัดการข้อผิดพลาด // การแจ้งเตือน ('ข้อผิดพลาด')}}); } // ถ้าแถวมีจำนวนลบถ้า (parseint (ค่า, 10) <0) {// เพิ่มคลาส "ลบ" td.classname = 'ลบ'; container1.HandSontable ({data: data1, minsparerows: 1, colheaders: จริง, นักพาย: จริง, บริบท: จริง, manualColumnResize: จริง, สูตร: จริง, เซลล์: ฟังก์ชั่น (แถว, col, prop) {var cellproperties = {}; var; handerible.helper.stringify (this.instance.getData () [row] [col]); </script>สูตรของ = sum (b5, e3) จัดทำโดยกฎ Return 1+2 เป็นสคริปต์รหัส C# ที่ใช้งานด้วยตัวเอง คุณต้องคลิกเพื่อแยกวิเคราะห์:
คลาสสาธารณะ CSEngine: ihttphandler {จำนวน int คงที่ส่วนตัว = 0; โมฆะสาธารณะ ProcessRequest (บริบท httpContext) {context.response.contentType = "ข้อความ/ธรรมดา"; ลอง {count ++; สตริง ret = ""; String code = context.request ["code"]. toString (); if (string.isnullorEmpty (รหัส)) {ret = "ข้อผิดพลาดพารามิเตอร์"; } else {scriptOptions opotions = scriptOptions.default .addreferences (assembly.getasembly (typeof (dbservices.dataaccess))) //.addimports("system.data ") //.addimports("system.data.sqlclient") var state = csharpscript.runasync (รหัส, ตัวเลือก) .result.returnvalue; ret = state.toString (); สถานะ = null; ตัวเลือก = null; } Console.WriteLine (นับ); Context.response.write (RET); } catch (Exception Ex) {// ข้อผิดพลาด console.writeLine (นับ); }} public bool isreusable {get {return false; -เรียกใช้รหัสดังนี้:
ข้างต้นเป็นเนื้อหาทั้งหมดของบทความนี้ ฉันหวังว่ามันจะเป็นประโยชน์ต่อการเรียนรู้ของทุกคนและฉันหวังว่าทุกคนจะสนับสนุน wulin.com มากขึ้น