Spread.Sheets V10不仅带来了功能升级,也对接口进行了优化,功能更加模块化,接口也更加合理。
为了方便用户过度升级,V10提供了兼容V9代码的方法。
只需要在引用V10 js后添加gc.spread.sheets.migration.10.0.0.js的引用即可实现向下兼容。这个文件在产品scripts\interop文件夹中。
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Spread.Sheets</title><link href="./css/gc.spread.sheets.excel2013white.10.0.0.css" rel="stylesheet"/><script src="./scripts/gc.spread.sheets.all.10.0.0.js" type="application/javascript"></script><script src="./scripts/interop/gc.spread.sheets.migration.10.0.0.js" type="application/javascript"></script><script type="text/javascript">window.onload = function(){//This is the V9 codevar spread = new GcSpread.Sheets.Spread(document.getElementById("ss"), { sheetCount: 3 });var sheet = spread.getActiveSheet();sheet.getColumn(0).formatter('#,##0.0##');sheet.setValue(0, 0, 123456);sheet.setValue(1, 0, 12345);}</script></head><body><div id="ss" style="width:100%;height:500px;border: 1px solid gray;"></div></body></html>
虽然我们可以持续在V10中使用V9的代码,但是从项目维护以及今后升级的角度,建议刚开始使用V9的用户直接进行V10代码的重构。 老用户也在新页面中开始使用新的方法,逐步替换掉V9代码.
有关V10中API的变化请参考:
http://sphelp.grapecity.com/webhelp/SpreadSheets10/webframe.html#APIchanges.html
更多资源
如果您对SpreadJS产品感兴趣,请到官方网站下载试用:/developer/spreadjs
产品咨询电话:400-657-6008
Spread.Sheets中文学习指南:http://demo.grapecity.com.cn/SpreadJS/TutorialSample/#/samples
Spread.Sheets在线英文产品文档:http://sphelp.grapecity.com/webhelp/SpreadSheets10/webframe.html