1、版本号
版本为16.2.6,Vue3。
2、问题描述
正确的表单效果样式如下图所示:
然后我使用sheet.toJSON()方法将表单的内容导出为JSON字符串存储到后台数据库。
接下来我使用sheet.fromJSON(JSON对象)方法将上述导出来的JSON对象还原表单,结果发现样式全部丢失了,如下图所示:
3、导出的JSON字符串
其中sheet.toJSON()方法导出的JSON字符串如下所示:
- {"name":"检测报告-表头","isSelected":true,"rowCount":17,"columnCount":12,"activeRow":16,"activeCol":11,"visible":1,"theme":{"name":"Office","themeColor":{"name":"Office","background1":{"a":255,"r":255,"g":255,"b":255},"background2":{"a":255,"r":231,"g":230,"b":230},"text1":{"a":255,"r":0,"g":0,"b":0},"text2":{"a":255,"r":68,"g":84,"b":106},"accent1":{"a":255,"r":68,"g":114,"b":196},"accent2":{"a":255,"r":237,"g":125,"b":49},"accent3":{"a":255,"r":165,"g":165,"b":165},"accent4":{"a":255,"r":255,"g":192,"b":0},"accent5":{"a":255,"r":91,"g":155,"b":213},"accent6":{"a":255,"r":112,"g":173,"b":71},"hyperlink":{"a":255,"r":5,"g":99,"b":193},"followedHyperlink":{"a":255,"r":149,"g":79,"b":114}},"headingFont":"'Calibri Light'","bodyFont":"Calibri","font":{"headerFont":"'Calibri Light'","bodyFont":"Calibri"}},"data":{"dataTable":{"0":{"0":{"value":"水泥混凝土立方体抗压强度试验检测报告","style":"__builtInStyle6"},"1":{"style":"__builtInStyle6"},"2":{"style":"__builtInStyle6"},"3":{"style":"__builtInStyle6"},"4":{"style":"__builtInStyle6"},"5":{"style":"__builtInStyle6"},"6":{"style":"__builtInStyle6"},"7":{"style":"__builtInStyle6"},"8":{"style":"__builtInStyle6"},"9":{"style":"__builtInStyle6"},"10":{"style":"__builtInStyle6"},"11":{"style":"__builtInStyle6"}},"1":{"0":{"value":"检测单位名称(专用章):","style":"__builtInStyle5"},"1":{"style":"__builtInStyle5"},"2":{"value":"四川川桥工程试验检测有限责任公司乐山至西昌高速公路马边至昭觉段S2合同段第二工地试验室","style":"__builtInStyle7"},"3":{"style":"__builtInStyle7"},"4":{"style":"__builtInStyle7"},"5":{"style":"__builtInStyle7"},"6":{"style":"__builtInStyle7"},"7":{"style":"__builtInStyle7"},"8":{"value":"报告编号:","style":"__builtInStyle2"},"9":{"value":"BG-202310(S2-2)-TYH-0002","style":"__builtInStyle5"},"10":{"style":"__builtInStyle5"},"11":{"style":"__builtInStyle5"}},"2":{"0":{"value":"施工/委托单位","style":"__builtInStyle14"},"1":{"style":"__builtInStyle8"},"2":{"value":"四川省交通建设集团股份有限公司","style":"__builtInStyle9"},"3":{"style":"__builtInStyle9"},"4":{"style":"__builtInStyle9"},"5":{"style":"__builtInStyle9"},"6":{"value":"工程名称","style":"__builtInStyle8"},"7":{"style":"__builtInStyle8"},"8":{"value":"乐山至西昌高速公路马边至昭觉段","style":"__builtInStyle9"},"9":{"style":"__builtInStyle9"},"10":{"style":"__builtInStyle9"},"11":{"style":"__builtInStyle10"}},"3":{"0":{"value":"工程部位/用途","style":"__builtInStyle15"},"1":{"style":"__builtInStyle13"},"2":{"value":"拉一木隧道右线K123+870~K123+880二次衬砌拱墙","style":"__builtInStyle11"},"3":{"style":"__builtInStyle11"},"4":{"style":"__builtInStyle11"},"5":{"style":"__builtInStyle11"},"6":{"style":"__builtInStyle11"},"7":{"style":"__builtInStyle11"},"8":{"style":"__builtInStyle11"},"9":{"style":"__builtInStyle11"},"10":{"style":"__builtInStyle11"},"11":{"style":"__builtInStyle12"}},"4":{"0":{"value":"样品信息","style":"__builtInStyle15"},"1":{"style":"__builtInStyle13"},"2":{"value":"样品名称:水泥混凝土试件 样品编号:YP-202310(S2-2)-TYH-0002 样品状态:表面平整、无蜂窝麻面、无缺损","style":"__builtInStyle11"},"3":{"style":"__builtInStyle11"},"4":{"style":"__builtInStyle11"},"5":{"style":"__builtInStyle11"},"6":{"style":"__builtInStyle11"},"7":{"style":"__builtInStyle11"},"8":{"style":"__builtInStyle11"},"9":{"style":"__builtInStyle11"},"10":{"style":"__builtInStyle11"},"11":{"style":"__builtInStyle12"}},"5":{"0":{"value":"检测依据","style":"__builtInStyle15"},"1":{"style":"__builtInStyle13"},"2":{"value":"JTG 3420-2020","style":"__builtInStyle11"},"3":{"style":"__builtInStyle11"},"4":{"style":"__builtInStyle11"},"5":{"style":"__builtInStyle11"},"6":{"value":"判定依据","style":"__builtInStyle13"},"7":{"style":"__builtInStyle13"},"8":{"value":"设计文件","style":"__builtInStyle11"},"9":{"style":"__builtInStyle11"},"10":{"style":"__builtInStyle11"},"11":{"style":"__builtInStyle12"}},"6":{"0":{"value":"主要仪器设备名称及编号","style":"__builtInStyle16"},"1":{"style":"__builtInStyle17"},"2":{"value":"游标卡尺(LX-8),微机电液伺服压力试验机(LX-146)","style":"__builtInStyle3"},"3":{"style":"__builtInStyle3"},"4":{"style":"__builtInStyle3"},"5":{"style":"__builtInStyle3"},"6":{"style":"__builtInStyle3"},"7":{"style":"__builtInStyle3"},"8":{"style":"__builtInStyle3"},"9":{"style":"__builtInStyle3"},"10":{"style":"__builtInStyle3"},"11":{"style":"__builtInStyle4"}},"7":{"0":{"style":"__builtInStyle1"},"1":{"style":"__builtInStyle1"}}},"defaultDataNode":{"style":{"backColor":null,"foreColor":"Text 1 0","vAlign":1,"font":"normal normal 14.6667px Calibri","themeFont":"Body","formatter":"General","borderLeft":null,"borderTop":null,"borderRight":null,"borderBottom":null,"locked":true,"textIndent":0,"wordWrap":false,"shrinkToFit":false,"textDecoration":0,"isVerticalText":false,"textOrientation":0}}},"rowHeaderData":{"defaultDataNode":{"style":{"themeFont":"Body"}}},"colHeaderData":{"defaultDataNode":{"style":{"themeFont":"Body"}}},"rows":[{"size":40},{"size":40},{"size":27},{"size":27},{"size":27},{"size":27},{"size":27}],"defaultData":{},"leftCellIndex":0,"topCellIndex":0,"spans":[{"row":6,"col":0,"rowCount":1,"colCount":2},{"row":2,"col":2,"rowCount":1,"colCount":4},{"row":6,"col":2,"rowCount":1,"colCount":10},{"row":1,"col":0,"rowCount":1,"colCount":2},{"row":0,"col":0,"rowCount":1,"colCount":12},{"row":1,"col":9,"rowCount":1,"colCount":3},{"row":1,"col":2,"rowCount":1,"colCount":6},{"row":2,"col":6,"rowCount":1,"colCount":2},{"row":2,"col":8,"rowCount":1,"colCount":4},{"row":3,"col":2,"rowCount":1,"colCount":10},{"row":4,"col":2,"rowCount":1,"colCount":10},{"row":5,"col":2,"rowCount":1,"colCount":4},{"row":5,"col":6,"rowCount":1,"colCount":2},{"row":5,"col":8,"rowCount":1,"colCount":4},{"row":2,"col":0,"rowCount":1,"colCount":2},{"row":3,"col":0,"rowCount":1,"colCount":2},{"row":4,"col":0,"rowCount":1,"colCount":2},{"row":5,"col":0,"rowCount":1,"colCount":2}],"selections":{"0":{"row":16,"col":11,"rowCount":1,"colCount":1},"length":1},"defaults":{"colHeaderRowHeight":20,"colWidth":64,"rowHeaderColWidth":40,"rowHeight":19,"_isExcelDefaultColumnWidth":true},"rowOutlines":{"items":[]},"columnOutlines":{"items":[]},"cellStates":{},"states":{},"outlineColumnOptions":{},"autoMergeRangeInfos":[]}
复制代码
请问sheet.toJSON()方法不支持导出样式吗?还是我没操作对呢?救急,救急,救急!!!
|
|