找回密码
 立即注册

QQ登录

只需一步,快速开始

mzq760191762

注册会员

9

主题

31

帖子

96

积分

注册会员

积分
96
mzq760191762
注册会员   /  发表于:2017-11-15 11:15  /   查看:3959  /  回复:5
  1.         var sheet = this.spread.sheets[3];
  2.         var person = this.aa
  3.         var typename = [
  4.           'oneyear.value.coalescing.accountsReceivable',
  5.           'oneyear.value.coalescing.prepayment',
  6.           'oneyear.value.coalescing.inventory',
  7.           'oneyear.value.coalescing.currentAssets',
  8.           'oneyear.value.coalescing.totalAssets',
  9.           'oneyear.value.coalescing.currentLiabilities',
  10.           'oneyear.value.coalescing.totalLiabilities',
  11.           '',
  12.           'oneyear.value.coalescing.operatingIncome',
  13.           'oneyear.value.coalescing.operatingCosts',
  14.           'oneyear.value.coalescing.businessTax',
  15.           'oneyear.value.coalescing.interestExpense',
  16.           'oneyear.value.coalescing.theChangeOfIncomeFairValue',
  17.           'oneyear.value.coalescing.investmentIncome',
  18.           'oneyear.value.coalescing.totalProfit',
  19.           'oneyear.value.coalescing.netProfit',
  20.           '',
  21.           'oneyear.value.coalescing.cashFlowFromOperations',
  22.           'oneyear.value.coalescing.investingCashFlows',
  23.           'oneyear.value.coalescing.cashFlowsFromFinancing',
  24.         ]
  25.         var typename2 = [
  26.           'twoyear.value.coalescing.accountsReceivable',
  27.           'twoyear.value.coalescing.prepayment',
  28.           'twoyear.value.coalescing.inventory',
  29.           'twoyear.value.coalescing.currentAssets',
  30.           'twoyear.value.coalescing.totalAssets',
  31.           'twoyear.value.coalescing.currentLiabilities',
  32.           'twoyear.value.coalescing.totalLiabilities',
  33.           '',
  34.           'twoyear.value.coalescing.operatingIncome',
  35.           'twoyear.value.coalescing.operatingCosts',
  36.           'twoyear.value.coalescing.businessTax',
  37.           'twoyear.value.coalescing.interestExpense',
  38.           'twoyear.value.coalescing.theChangeOfIncomeFairValue',
  39.           'twoyear.value.coalescing.investmentIncome',
  40.           'twoyear.value.coalescing.totalProfit',
  41.           'twoyear.value.coalescing.netProfit',
  42.           '',
  43.           'twoyear.value.coalescing.cashFlowFromOperations',
  44.           'twoyear.value.coalescing.investingCashFlows',
  45.           'twoyear.value.coalescing.cashFlowsFromFinancing',

  46.         ]
  47.         var typename3 = [
  48.           'threeyear.value.coalescing.accountsReceivable',
  49.           'threeyear.value.coalescing.prepayment',
  50.           'threeyear.value.coalescing.inventory',
  51.           'threeyear.value.coalescing.currentAssets',
  52.           'threeyear.value.coalescing.totalAssets',
  53.           'threeyear.value.coalescing.currentLiabilities',
  54.           'threeyear.value.coalescing.totalLiabilities',
  55.           '',
  56.           'threeyear.value.coalescing.operatingIncome',
  57.           'threeyear.value.coalescing.operatingCosts',
  58.           'threeyear.value.coalescing.businessTax',
  59.           'threeyear.value.coalescing.interestExpense',
  60.           'threeyear.value.coalescing.theChangeOfIncomeFairValue',
  61.           'threeyear.value.coalescing.investmentIncome',
  62.           'threeyear.value.coalescing.totalProfit',
  63.           'threeyear.value.coalescing.netProfit',
  64.           '',
  65.           'threeyear.value.coalescing.cashFlowFromOperations',
  66.           'threeyear.value.coalescing.investingCashFlows',
  67.           'threeyear.value.coalescing.cashFlowsFromFinancing',
  68.         ]
  69.         var typename4 = [
  70.           'oneyear.value.parentCompany.accountsReceivable',
  71.           'oneyear.value.parentCompany.prepayment',
  72.           'oneyear.value.parentCompany.inventory',
  73.           'oneyear.value.parentCompany.currentAssets',
  74.           'oneyear.value.parentCompany.totalAssets',
  75.           'oneyear.value.parentCompany.currentLiabilities',
  76.           'oneyear.value.parentCompany.totalLiabilities',
  77.           '',
  78.           'oneyear.value.parentCompany.operatingIncome',
  79.           'oneyear.value.parentCompany.operatingCosts',
  80.           'oneyear.value.parentCompany.businessTax',
  81.           'oneyear.value.parentCompany.interestExpense',
  82.           'oneyear.value.parentCompany.theChangeOfIncomeFairValue',
  83.           'oneyear.value.parentCompany.investmentIncome',
  84.           'oneyear.value.parentCompany.totalProfit',
  85.           'oneyear.value.parentCompany.netProfit',
  86.           '',
  87.           'oneyear.value.parentCompany.cashFlowFromOperations',
  88.           'oneyear.value.parentCompany.investingCashFlows',
  89.           'oneyear.value.parentCompany.cashFlowsFromFinancing',
  90.         ]
  91.         var typename5 = [
  92.           'twoyear.value.parentCompany.accountsReceivable',
  93.           'twoyear.value.parentCompany.prepayment',
  94.           'twoyear.value.parentCompany.inventory',
  95.           'twoyear.value.parentCompany.currentAssets',
  96.           'twoyear.value.parentCompany.totalAssets',
  97.           'twoyear.value.parentCompany.currentLiabilities',
  98.           'twoyear.value.parentCompany.totalLiabilities',
  99.           '',
  100.           'twoyear.value.parentCompany.operatingIncome',
  101.           'twoyear.value.parentCompany.operatingCosts',
  102.           'twoyear.value.parentCompany.businessTax',
  103.           'twoyear.value.parentCompany.interestExpense',
  104.           'twoyear.value.parentCompany.theChangeOfIncomeFairValue',
  105.           'twoyear.value.parentCompany.investmentIncome',
  106.           'twoyear.value.parentCompany.totalProfit',
  107.           'twoyear.value.parentCompany.netProfit',
  108.           '',
  109.           'twoyear.value.parentCompany.cashFlowFromOperations',
  110.           'twoyear.value.parentCompany.investingCashFlows',
  111.           'twoyear.value.parentCompany.cashFlowsFromFinancing',
  112.         ]
  113.         var typename6 = [
  114.           'threeyear.value.parentCompany.accountsReceivable',
  115.           'threeyear.value.parentCompany.prepayment',
  116.           'threeyear.value.parentCompany.inventory',
  117.           'threeyear.value.parentCompany.currentAssets',
  118.           'threeyear.value.parentCompany.totalAssets',
  119.           'threeyear.value.parentCompany.currentLiabilities',
  120.           'threeyear.value.parentCompany.totalLiabilities',
  121.           '',
  122.           'threeyear.value.parentCompany.operatingIncome',
  123.           'threeyear.value.parentCompany.operatingCosts',
  124.           'threeyear.value.parentCompany.businessTax',
  125.           'threeyear.value.parentCompany.interestExpense',
  126.           'threeyear.value.parentCompany.theChangeOfIncomeFairValue',
  127.           'threeyear.value.parentCompany.investmentIncome',
  128.           'threeyear.value.parentCompany.totalProfit',
  129.           'threeyear.value.parentCompany.netProfit',
  130.           '',
  131.           'threeyear.value.parentCompany.cashFlowFromOperations',
  132.           'threeyear.value.parentCompany.investingCashFlows',
  133.           'threeyear.value.parentCompany.cashFlowsFromFinancing',

  134.         ]
  135.         var source = new GC.Spread.Sheets.Bindings.CellBindingSource(person);
  136.         sheet.setBindingPath(2, 2, 'oneyear.year');
  137.         sheet.setBindingPath(2, 3, 'twoyear.year');
  138.         sheet.setBindingPath(2, 4, 'threeyear.year');
  139.         sheet.setBindingPath(30, 2, 'oneyear.year');
  140.         sheet.setBindingPath(30, 3, 'twoyear.year');
  141.         sheet.setBindingPath(30, 4, 'threeyear.year');
  142.         sheet.setText(7, 7, '01/01/2014');
  143.         var num = 3
  144.         for (var i = 0; i < 20;i++){
  145.           num++
  146.             sheet.setBindingPath(num, 2, typename[i])
  147.             sheet.setBindingPath(num, 3, typename2[i])
  148.             sheet.setBindingPath(num, 4, typename3[i])
  149.         }
  150.         var num2 = 31
  151.         for (var n = 0; n < 20; n++) {
  152.           num2++
  153.           sheet.setBindingPath(num2, 2, typename4[n])
  154.           sheet.setBindingPath(num2, 3, typename5[n])
  155.           sheet.setBindingPath(num2, 4, typename6[n])
  156.         }
  157.         sheet.setDataSource(source);
复制代码
这是插入代码的部分,setValue,setArray,getText输入数据都可以导出,但是setBindingPath 导出就是空的,全部都是空的,一个都没有
然后还有一个问题,有没有好的批量导入导出数据的方法,

5 个回复

倒序浏览
Clark.Pan讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-11-15 12:10:20
沙发
您好:

导出时设置includeBindingSource: true ,这样就可以导出绑定的数据了
相关文档参考:
http://demo.gcpowertools.com.cn/ ... dataSourceSerialize
回复 使用道具 举报
mzq760191762
注册会员   /  发表于:2017-11-15 12:48:27
板凳
ClarkPan 发表于 2017-11-15 12:10
您好:

导出时设置includeBindingSource: true ,这样就可以导出绑定的数据了

您好,对于获取数据您有好的建议吗,我这边是后端发送数据到前端测算后再返回后端的,目前导入数据用的setBindingPath绑定导入,有没有批量获取json格式数据的方式,
回复 使用道具 举报
Clark.Pan讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-11-15 14:03:49
地板
您好,我没有明白您说的有没有批量获取json格式数据的方式的意思。您导出是怎么导出的?是用的我们服务器端的导入导出?还是说您自己写的导出Excel
回复 使用道具 举报
mzq760191762
注册会员   /  发表于:2017-11-15 14:32:54
5#
ClarkPan 发表于 2017-11-15 14:03
您好,我没有明白您说的有没有批量获取json格式数据的方式的意思。您导出是怎么导出的?是用的我们服务器端 ...

不是,流程是这样的   前端获取数据,然后放入表格进行测算,测算完成后把测算结果返回后端,但是返回的是json格式嘛,一个一个去获取太费事了,所以问问有没有批量获取然后生成json数据
回复 使用道具 举报
Clark.Pan讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-11-15 18:03:45
6#
您好:

getArray方法能够获取页面上指定范围的数据,相关文档您可以参考:
http://help.grapecity.com/spread ... sheet~getArray.html
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部