找回密码
 立即注册

QQ登录

只需一步,快速开始

注册会员

1

主题

2

帖子

12

积分

注册会员

积分
12
  • 33

    金币

  • 1

    主题

  • 2

    帖子

最新发帖

注册会员   /  发表于:2021-8-13 16:51  /   查看:1732  /  回复:3
1金币
前端将exceljson提交给后端,后端构造workbook时出错:
Exception in thread "main" java.lang.IllegalStateException: Invalid argument: Number
        at com.grapecity.documents.excel.h.b.d(Unknown Source)
        at com.grapecity.documents.excel.h.g.d(Unknown Source)
        at com.grapecity.documents.excel.n.b.U.a(Unknown Source)
        at com.grapecity.documents.excel.n.b.U.b(Unknown Source)
        at com.grapecity.documents.excel.n.b.U.a(Unknown Source)
        at com.grapecity.documents.excel.n.b.U.a(Unknown Source)
        at com.grapecity.documents.excel.n.b.T.a(Unknown Source)
        at com.grapecity.documents.excel.n.b.T.a(Unknown Source)
        at com.grapecity.documents.excel.n.b.T.a(Unknown Source)
        at com.grapecity.documents.excel.Workbook.fromJson(Unknown Source)
        at com.grapecity.documents.excel.Workbook.fromJson(Unknown Source)

方法如下:
Workbook workbook = new Workbook();
        workbook.fromJson("{\"sheets\":{\"Sheet1\":{\"activeRow\":9,\"data\":{\"defaultDataNode\":{\"style\":{\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"borderTop\":{\"color\":\"\"},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"\"},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"\"},\"themeFont\":\"Body\",\"locked\":true,\"borderBottom\":{\"color\":\"\"},\"font\":\"normal normal 11pt Calibri,sans-serif\"}},\"dataTable\":{\"11\":{\"0\":{\"style\":{\"hAlign\":1,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":2,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"rgb(255,255,153)\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal bold 9pt 微软雅黑\"},\"value\":11}},\"12\":{\"0\":{\"style\":{\"hAlign\":3,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal normal 9pt 微软雅黑\"},\"value\":12}},\"13\":{\"0\":{\"style\":{\"hAlign\":1,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":2,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"rgb(255,255,153)\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal bold 9pt 微软雅黑\"},\"value\":13}},\"14\":{\"0\":{\"style\":{\"hAlign\":3,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal normal 9pt 微软雅黑\"},\"value\":14}},\"15\":{\"0\":{\"style\":{\"hAlign\":1,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":2,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"rgb(255,255,153)\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal bold 9pt 微软雅黑\"},\"value\":15}},\"16\":{\"0\":{\"style\":{\"hAlign\":3,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal normal 9pt 微软雅黑\"},\"value\":16}},\"0\":{\"0\":{\"style\":\"__builtInStyle-1-Sheet1\",\"value\":\"行次\"},\"1\":{\"style\":\"__builtInStyle-6-Sheet1\",\"value\":\" 项目 \"},\"2\":{\"style\":\"__builtInStyle-6-Sheet1\",\"value\":\" 2020年预测 \"},\"3\":{\"style\":\"__builtInStyle-6-Sheet1\",\"value\":\" 2021年规划 \"},\"4\":{\"style\":\"__builtInStyle-6-Sheet1\",\"value\":\" 2022年规划 \"},\"5\":{\"style\":\"__builtInStyle-6-Sheet1\",\"value\":\"2023年规划\"},\"6\":{\"style\":\"__builtInStyle-6-Sheet1\",\"value\":\"2024年规划\"},\"7\":{\"style\":\"__builtInStyle-13-Sheet1\",\"value\":\"2025年规划\"}},\"1\":{\"0\":{\"style\":\"__builtInStyle-2-Sheet1\",\"value\":1},\"1\":{\"style\":\"__builtInStyle-7-Sheet1\",\"value\":\"商品销售收入(含税)\"},\"2\":{\"style\":\"__builtInStyle-11-Sheet1\",\"value\":1},\"3\":{\"style\":\"__builtInStyle-11-Sheet1\",\"value\":\"23.0\"},\"4\":{\"style\":\"__builtInStyle-11-Sheet1\",\"value\":\"1.0\"},\"5\":{\"style\":\"__builtInStyle-11-Sheet1\",\"value\":\"3.0\"},\"6\":{\"style\":\"__builtInStyle-11-Sheet1\",\"value\":5},\"7\":{\"style\":\"__builtInStyle-11-Sheet1\",\"value\":6}},\"2\":{\"0\":{\"style\":\"__builtInStyle-3-Sheet1\",\"value\":2},\"1\":{\"style\":\"__builtInStyle-8-Sheet1\"},\"2\":{\"style\":\"__builtInStyle-12-Sheet1\",\"value\":43},\"3\":{\"style\":\"__builtInStyle-12-Sheet1\",\"value\":\"1.0\"},\"4\":{\"style\":\"__builtInStyle-12-Sheet1\",\"value\":43},\"5\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"6\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"7\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"8\":{\"value\":\"1.0\"}},\"3\":{\"0\":{\"style\":{\"hAlign\":1,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":2,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"rgb(255,255,153)\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal bold 9pt 微软雅黑\"},\"value\":3},\"1\":{\"style\":\"__builtInStyle-9-Sheet1\"},\"2\":{\"style\":\"__builtInStyle-11-Sheet1\"},\"3\":{\"style\":\"__builtInStyle-11-Sheet1\"},\"4\":{\"style\":\"__builtInStyle-11-Sheet1\"},\"5\":{\"style\":\"__builtInStyle-11-Sheet1\"},\"6\":{\"style\":\"__builtInStyle-11-Sheet1\"},\"7\":{\"style\":\"__builtInStyle-11-Sheet1\"}},\"4\":{\"0\":{\"style\":{\"hAlign\":3,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal normal 9pt 微软雅黑\"},\"value\":4},\"1\":{\"style\":\"__builtInStyle-9-Sheet1\"},\"2\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"3\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"4\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"5\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"6\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"7\":{\"style\":\"__builtInStyle-12-Sheet1\"}},\"5\":{\"0\":{\"style\":{\"hAlign\":1,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":2,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"rgb(255,255,153)\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal bold 9pt 微软雅黑\"},\"value\":5},\"1\":{\"style\":\"__builtInStyle-9-Sheet1\"},\"2\":{\"style\":\"__builtInStyle-11-Sheet1\"},\"3\":{\"style\":\"__builtInStyle-11-Sheet1\"},\"4\":{\"style\":\"__builtInStyle-11-Sheet1\"},\"5\":{\"style\":\"__builtInStyle-11-Sheet1\"},\"6\":{\"style\":\"__builtInStyle-11-Sheet1\"},\"7\":{\"style\":\"__builtInStyle-11-Sheet1\"}},\"6\":{\"0\":{\"style\":{\"hAlign\":3,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal normal 9pt 微软雅黑\"},\"value\":6},\"1\":{\"style\":\"__builtInStyle-10-Sheet1\"},\"2\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"3\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"4\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"5\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"6\":{\"style\":\"__builtInStyle-12-Sheet1\"},\"7\":{\"style\":\"__builtInStyle-12-Sheet1\"}},\"7\":{\"0\":{\"style\":{\"hAlign\":1,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":2,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"rgb(255,255,153)\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal bold 9pt 微软雅黑\"},\"value\":7},\"6\":{},\"7\":{}},\"8\":{\"0\":{\"style\":{\"hAlign\":3,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal normal 9pt 微软雅黑\"},\"value\":8},\"10\":{}},\"9\":{\"0\":{\"style\":{\"hAlign\":1,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":2,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"rgb(255,255,153)\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal bold 9pt 微软雅黑\"},\"value\":9}},\"10\":{\"0\":{\"style\":{\"hAlign\":3,\"wordWrap\":false,\"imeMode\":1,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"normal normal 9pt 微软雅黑\"},\"value\":10}}}},\"namedStyles\":[{\"hAlign\":1,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"name\":\"__builtInStyle-1-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"700 12px 微软雅黑\"},{\"hAlign\":1,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":2,\"borderTop\":{\"color\":\"\"},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"rgb(255,255,153)\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"name\":\"__builtInStyle-2-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"700 12px 微软雅黑\"},{\"hAlign\":3,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{\"color\":\"\"},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"name\":\"__builtInStyle-3-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"12px 微软雅黑\"},{\"hAlign\":1,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":2,\"borderTop\":{\"color\":\"\"},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"name\":\"__builtInStyle-4-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"700 12px 微软雅黑\"},{\"hAlign\":1,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{\"color\":\"\"},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"name\":\"__builtInStyle-5-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"12px 微软雅黑\"},{\"hAlign\":1,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"\"},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"name\":\"__builtInStyle-6-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"700 12px 微软雅黑\"},{\"hAlign\":0,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{\"color\":\"\"},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"\"},\"shrinkToFit\":false,\"backColor\":\"rgb(255,255,153)\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"name\":\"__builtInStyle-7-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"700 12px 微软雅黑\"},{\"hAlign\":0,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"rgb(75,172,198)\",\"vAlign\":1,\"borderTop\":{\"color\":\"\"},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"\"},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"name\":\"__builtInStyle-8-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"italic 12px 微软雅黑\"},{\"hAlign\":0,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{\"color\":\"\"},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"\"},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"name\":\"__builtInStyle-9-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"12px 微软雅黑\"},{\"hAlign\":3,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{\"color\":\"\"},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"\"},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"name\":\"__builtInStyle-10-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"12px 微软雅黑\"},{\"hAlign\":3,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{\"color\":\"\"},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"\"},\"shrinkToFit\":false,\"backColor\":\"rgb(255,255,153)\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"name\":\"__builtInStyle-11-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"12px 微软雅黑\"},{\"hAlign\":3,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"rgb(75,172,198)\",\"vAlign\":1,\"borderTop\":{\"color\":\"\"},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"\"},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"name\":\"__builtInStyle-12-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"italic 12px 微软雅黑\"},{\"hAlign\":1,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":1,\"borderTop\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"\"},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"rgb(0,0,0)\",\"style\":2},\"name\":\"__builtInStyle-13-Sheet1\",\"locked\":true,\"borderBottom\":{\"color\":\"rgb(0,0,0)\",\"style\":1},\"font\":\"700 12px 微软雅黑\"}],\"rowHeaderData\":{\"defaultDataNode\":{\"style\":{\"themeFont\":\"Body\"}}},\"columns\":[{},{\"size\":167},{},{},{\"size\":87}],\"states\":{},\"topCellIndex\":0,\"shapeCollectionOption\":{\"snapMode\":0},\"isSelected\":true,\"autoMergeRangeInfos\":[],\"theme\":{\"themeColor\":{\"hyperlink\":{\"a\":255,\"r\":5,\"b\":193,\"g\":99},\"followedHyperlink\":{\"a\":255,\"r\":149,\"b\":114,\"g\":79},\"accent6\":{\"a\":255,\"r\":112,\"b\":71,\"g\":173},\"accent4\":{\"a\":255,\"r\":255,\"b\":0,\"g\":192},\"accent5\":{\"a\":255,\"r\":91,\"b\":213,\"g\":155},\"accent2\":{\"a\":255,\"r\":237,\"b\":49,\"g\":125},\"accent3\":{\"a\":255,\"r\":165,\"b\":165,\"g\":165},\"accent1\":{\"a\":255,\"r\":68,\"b\":196,\"g\":114},\"background1\":{\"a\":255,\"r\":255,\"b\":255,\"g\":255},\"background2\":{\"a\":255,\"r\":231,\"b\":230,\"g\":230},\"text1\":{\"a\":255,\"r\":0,\"b\":0,\"g\":0},\"text2\":{\"a\":255,\"r\":68,\"b\":106,\"g\":84},\"name\":\"Office\"},\"headingFont\":\"Calibri Light\",\"bodyFont\":\"Calibri\",\"name\":\"Office\"},\"rowCount\":183,\"colHeaderData\":{\"defaultDataNode\":{\"style\":{\"themeFont\":\"Body\"}}},\"rowOutlines\":{\"items\":[]},\"columnOutlines\":{\"items\":[]},\"printInfo\":{\"pageOrder\":1,\"showRowHeader\":1,\"showColumnHeader\":1,\"paperSize\":{\"kind\":1,\"width\":850,\"height\":1100}},\"index\":0,\"outlineColumnOptions\":{},\"rows\":[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}],\"leftCellIndex\":0,\"frozenTrailingColumnStickToEdge\":true,\"selections\":{\"0\":{\"col\":1,\"colCount\":1,\"row\":9,\"rowCount\":1},\"length\":1},\"activeCol\":1,\"frozenTrailingRowStickToEdge\":true,\"name\":\"Sheet1\",\"cellStates\":{}}},\"namedStyles\":[{\"hAlign\":3,\"wordWrap\":false,\"quotePrefix\":false,\"textIndent\":0,\"foreColor\":\"Text 1\",\"vAlign\":2,\"borderTop\":{\"color\":\"\"},\"formatter\":\"General\",\"borderLeft\":{\"color\":\"\"},\"shrinkToFit\":false,\"backColor\":\"\",\"borderRight\":{\"color\":\"\"},\"name\":\"Normal\",\"themeFont\":\"Body\",\"locked\":true,\"borderBottom\":{\"color\":\"\"},\"font\":\"normal normal 11pt Calibri,sans-serif\"}],\"tabStripRatio\":0.6,\"customList\":[],\"pivotCaches\":{},\"version\":\"14.1.0\"}");



最佳答案

查看完整内容

这边测试这种不一致是由于 JSON.parse()引起的。 对于浏览器返回的json,您使用JSON.stringify(JSON.parse(str))先做下处理,传递给后端。 然后使用workbook.fromJSON()进行加载json。 (str 为您发帖时提供的 json字符串,即下图) 测试下问题能否解决。

3 个回复

倒序浏览
最佳答案
最佳答案
Lynn.Dou讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2021-8-13 16:51:17
来自 4#
这边测试这种不一致是由于 JSON.parse()引起的。
对于浏览器返回的json,您使用JSON.stringify(JSON.parse(str))先做下处理,传递给后端。
然后使用workbook.fromJSON()进行加载json。
(str 为您发帖时提供的 json字符串,即下图)
image.png528867797.png

测试下问题能否解决。
回复 使用道具 举报
Lynn.Dou讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2021-8-13 17:57:00
2#
您好,
您使用的是哪个版本呢?
这边在V4.1.4测试,是可以正常加载json的,未复现您描述的问题。
具体您可以参考附件的demo。

请升级至最新版本测试问题是否存在,
如果问题仍未解决,请在demo基础上进行修改,提供能复现此问题的demo,
这边再实际测试下。

GCdemo.zip

80.75 KB, 下载次数: 42

回复 使用道具 举报

注册会员   /  发表于:2021-8-16 12:07:11
3#
本帖最后由 白 于 2021-8-16 12:14 编辑
Lynn.Dou 发表于 2021-8-13 17:57
您好,
您使用的是哪个版本呢?
这边在V4.1.4测试,是可以正常加载json的,未复现您描述的问题。

你好,我找到了引起出错的原因,但是还没有解决方法。
原因是这样的,我这边的浏览器返回的json中dataTable部分排序和您提供的示例不一致,经过测试发现,
您提供的排序是按数字类型排序的,0,1,2,3...这样,我这边的排序是11,12,13,14,15,16,0,1,2,3,4...这样的,也就是说11节点排序到前面了。会导致问题的出现。

按理说json格式应该是不在乎里面的属性排序的,不知道原因。

附件是会出错的数据,0813是可以正确加载的,0814是加载会出错的,对比一下就会发现内容是一样的,但是排序不对了。

import_ssjson_files.zip

5.3 KB, 下载次数: 29

0814是有问题的内同

回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部