本帖最后由 whalefall 于 2022-6-16 09:18 编辑
- var designer = GC.Spread.Sheets.Designer;
- var spread = designer.wrapper.spread;var data = '{"version":"11.1.0","sheets":{"Sheet1":{"name":"Sheet1","options":{"isProtected":true},"rowCount":2,"columnCount":21,"activeRow":2,"activeCol":1,"theme":"Office","data":{"dataTable":{"1":{"1":{"value":123123}}},"defaultDataNode":{"style":{"themeFont":"Body"}}},"rowHeaderData":{"defaultDataNode":{"style":{"themeFont":"Body"}}},"colHeaderData":{"defaultDataNode":{"style":{"themeFont":"Body"}}},"rows":[{"size":1}],"columns":[{"size":1}],"selections":{"0":{"row":2,"rowCount":199,"col":1,"colCount":18},"length":1},"index":0}}}';
- spread.fromJSON(JSON.parse(data));
- var options = sheet.options;
- spread.options.showVerticalScrollbar = false;
- spread.options.showHorizontalScrollbar = false;
- spread.options.tabStripVisible = false;
- spread.options.hideSelection = true;
- spread.options.scrollbarMaxAlign = true;
- spread.options.scrollbarShowMax = true;
- sheet.options.rowHeaderVisible = false;
- sheet.options.colHeaderVisible = false;
- options.protectionOptions = {
- allowSelectLockedCells: false,
- allowSelectUnlockedCells: false,
- allowFilter: false,
- allowSort: false,
- allowResizeRows: false,
- allowResizeColumns: false,
- allowEditObjects: false,
- allowDragInsertRows: false,
- allowDragInsertColumns: false,
- allowInsertRows: false,
- allowInsertColumns: false,
- allowDeleteRows: false,
- allowDeleteColumns: false
- };
- options.isProtected = true; //此处导致死循环
复制代码 代码业务需求:让表格加载完后处于不可编辑状态,如下图所示:
复现的步骤:
1,在编辑页面编辑excel,只输入第一行第一个单元格,后面的行全部删除,然后保存,调用spread.toJSON()并存下数据
2,在展示页面执行上述代码,获取到json数据,构造excel.
3,调试发现出现死循环。
|
|