TY呀TY 发表于 2022-11-16 17:17:12

GcExcel FromJSON 替换表单数据

{"name":"Sheet1","isSelected":true,"activeRow":11,"activeCol":12,"frozenTrailingRowStickToEdge":true,"frozenTrailingColumnStickToEdge":true,"theme":"Office","data":{"dataTable":{"0":{"3":{"style":{"backColor":"Background 2"}},"4":{"value":123,"style":{"backColor":"Background 2"}},"5":{"style":{"backColor":"Background 2"}},"6":{"style":{"backColor":"Background 2"}},"7":{"style":{"backColor":"Background 2"}}},"1":{"3":{"style":{"backColor":"Background 2"}},"4":{"value":123,"style":{"backColor":"Background 2"}},"5":{"value":123,"style":{"backColor":"Background 2"}},"6":{"value":12,"style":{"backColor":"Background 2"}},"7":{"style":{"backColor":"Background 2"}}},"2":{"3":{"style":{"backColor":"Background 2"}},"4":{"value":123,"style":{"backColor":"Background 2"}},"5":{"value":12,"style":{"backColor":"Background 2"}},"6":{"value":3,"style":{"backColor":"Background 2"}},"7":{"value":3123,"style":{"backColor":"Background 2"}}},"3":{"3":{"style":{"backColor":"Background 2"}},"4":{"value":123,"style":{"backColor":"Background 2"}},"5":{"value":3,"style":{"backColor":"Background 2"}},"6":{"value":123,"style":{"backColor":"Background 2"}},"7":{"style":{"backColor":"Background 2"}}},"4":{"3":{"style":{"backColor":"Background 2"}},"4":{"style":{"backColor":"Background 2"}},"5":{"style":{"backColor":"Background 2"}},"6":{"style":{"backColor":"Background 2"}},"7":{"style":{"backColor":"Background 2"}}},"5":{"3":{"style":{"backColor":"Background 2","borderBottom":{"style":1}}},"4":{"style":{"backColor":"Background 2","borderBottom":{"style":1}}},"5":{"style":{"backColor":"Background 2","borderBottom":{"style":1}}},"6":{"style":{"backColor":"Background 2","borderBottom":{"style":1}}},"7":{"style":{"backColor":"Background 2","borderBottom":{"style":1}}}},"9":{"6":{"value":12}},"11":{"5":{"style":{"backColor":"Accent 3"}}}},"defaultDataNode":{"style":{"themeFont":"Body"}}},"rowHeaderData":{"defaultDataNode":{"style":{"themeFont":"Body"}}},"colHeaderData":{"defaultDataNode":{"style":{"themeFont":"Body"}}},"leftCellIndex":0,"topCellIndex":0,"selections":{"0":{"row":11,"rowCount":1,"col":12,"colCount":1},"selectionPolicy":1,"length":1},"rowOutlines":{"items":[]},"columnOutlines":{"items":[]},"cellStates":{},"states":{},"outlineColumnOptions":{},"autoMergeRangeInfos":[],"printInfo":{"paperSize":{"width":850,"height":1100,"kind":1}},"shapeCollectionOption":{"snapMode":0}},




给后端,后端通过FromJSON替换某个表单,样式设置不生效,style字段消失是什么原因,









Ellia.Duan 发表于 2022-11-16 17:52:35

您问题中的sheet json是通过sheet.toJSON()来获取的呢?还是通过spread.toJSON 后截取了sheet部分的json对象呢?
如果是后者的话,建议您通过前者来获取json 。
如果是前者的话,这边会进一步调研。

TY呀TY 发表于 2022-11-16 17:55:14

Ellia.Duan 发表于 2022-11-16 17:52
您问题中的sheet json是通过sheet.toJSON()来获取的呢?还是通过spread.toJSON 后截取了sheet部分的json对 ...

是通过sheet.toJSON( )来获取的
然后给后端,后端在通过From.JSON( )来替换

Ellia.Duan 发表于 2022-11-16 17:58:11

收到,这边验证后给您回复。

Ellia.Duan 发表于 2022-11-17 11:35:20

本帖最后由 Ellia.Duan 于 2022-11-17 11:38 编辑

您好,经过验证,这边暂未复现您的问题,截图如下:


在GcExcel中对sheet对象进行fromJson ,然后将其导出为xlsx文件,最后打开xlsx文件,发现有样式。

在在线表格编辑其中,通过sheet.fromJSON()导入您的json对象,效果如下:


其效果与通过GcExcel导出的xlsx样式一致。

TY呀TY 发表于 2022-11-17 20:11:30

已测试

这是fromJSON传入的数据



这是设置worksheet后,sheet的json数据


不知道是否有jar包版本的问题,目前用的是5.0.0的

Ellia.Duan 发表于 2022-11-18 09:35:39

TY呀TY 发表于 2022-11-17 20:11
已测试

这是fromJSON传入的数据


请您上传下您的getExcelDataJson类

TY呀TY 发表于 2022-11-18 10:04:35

本帖最后由 TY呀TY 于 2022-11-18 10:05 编辑

Ellia.Duan 发表于 2022-11-18 09:35
请您上传下您的getExcelDataJson类
就是我上面发的json字符串,通过那个json字符串进行fromJson

Ellia.Duan 发表于 2022-11-18 16:04:44

这边正在为您调研,待有结果第一时间通知您。

Ellia.Duan 发表于 2022-11-18 17:55:06

您好,此问题已修复,您可以在新版本V5.2.3进行测试。如果还有问题,可以追贴询问。
页: [1] 2
查看完整版本: GcExcel FromJSON 替换表单数据