本帖最后由 ccooder 于 2019-2-1 17:24 编辑
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>SpreadJS</title>
- <link rel="stylesheet" href="gc.spread.sheets.excel2016colorful.12.0.0.css"/>
- </head>
- <body>
- <div id="spread" style="position:absolute; top:0; left:0;width:100%; height:100%;border: 1px solid gray;"></div>
- <script src="gc.spread.sheets.all.12.0.0.min.js"></script>
- <script src="gc.spread.sheets.resources.zh.12.0.0.min.js"></script>
- <script src="jquery-3.3.1.js"></script>
- <script>
- window.onload = function () {
- var spread = new GC.Spread.Sheets.Workbook(document.getElementById('spread'), {sheetCount: 1});
- // var spread = GC.Spread.Sheets.findControl("spread");
- var spreadNS = GC.Spread.Sheets;
- var combo = new spreadNS.CellTypes.ComboBox();
- combo.items([{text: "Red", value: "1"}, {text: "Green", value: "2"}, {text: "Blue", value: "3"}, {
- text: "White",
- value: "4"
- }])
- .editorValueType(spreadNS.CellTypes.EditorValueType.value);
- var sheet = spread.getActiveSheet();
- sheet.getRange(1, 2).cellType(combo);
- sheet.getCell(1, 2, spreadNS.SheetArea.viewport).cellType(combo).value("Apples");
- sheet.copyTo(1, 0, 2, 0, 1, 4, GC.Spread.Sheets.CopyToOptions.all);
- sheet.copyTo(1, 0, 3, 0, 1, 4, GC.Spread.Sheets.CopyToOptions.all);
- var style = sheet.getStyle(1, 2);
- style.backColor = '#C3C7CB';
- style.locked = true;
- sheet.setStyle(2, 2, style, GC.Spread.Sheets.SheetArea.viewport);
- sheet.setStyle(3, 2, style, GC.Spread.Sheets.SheetArea.viewport);
- sheet.setCellType(1, 2, null);
-
- }
- </script>
- </body>
- </html>
复制代码
版本V12.0.0这个代码 运行会发现 我只设置了第一行的Combox为普通的文本,但是其他的都变了
如果把设置样式的去掉的话 就没有这个问题
|