기존 표에 조건부 서식 및/또는 데이터 유효성 검사 규칙과 새로 추가된 표 행 또는 열 교차가 있거나 기존 표가 조건부 서식/데이터 유효성 검사 범위에 인접한 경우 다음 작업 중 하나가 수행될 때 규칙이 새로 추가된 데이터에 자동으로 적용됩니다.
표 행 삽입
표 열 삽입
표 자동 확장
표 크기 조정
window.onload = function () {
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
initSpread(spread);
};
function initSpread(spread) {
var sheet1 = spread.getSheet(0);
var spreadNS = GC.Spread.Sheets;
var table = sheet1.tables.add("Table1", 2, 1, 9, 5, spreadNS.Tables.TableThemes["medium4"]);
for (var i = 1; i <= 8; i++) {
sheet1.getCell(2 + i, 1).value(i + 1);
sheet1.getCell(2 + i, 2).value(i + 2);
sheet1.getCell(2 + i, 3).value(i + 3);
sheet1.getCell(2 + i, 4).value(i + 4);
sheet1.getCell(2 + i, 5).value(i + 5);
}
sheet1.setColumnWidth(1, 100);
sheet1.setColumnWidth(2, 100);
sheet1.setColumnWidth(3, 100);
sheet1.setColumnWidth(4, 100);
sheet1.setColumnWidth(5, 100);
var cfs = sheet1.conditionalFormats;
var style = new spreadNS.Style();
style.backColor = '#F4F8EB';
style.foreColor = '#82bc00';
//apply style for numbers greater than 8
var cvRule = cfs.addCellValueRule(
spreadNS.ConditionalFormatting.ComparisonOperators.greaterThan,
8, 0, style, [new GC.Spread.Sheets.Range(3, 5, 8, 1)]);
spread.options.highlightInvalidData = true;
//Numbers between 4,6 are invalid
sheet1.getRange(3, 1, 8, 5).validator(spreadNS.DataValidation.createNumberValidator(spreadNS.ConditionalFormatting.ComparisonOperators.notBetween, 4, 6, false));
}
function _getElementById(id) {
return document.getElementById(id);
}
<!doctype html>
<html style="height:100%;font-size:14px;">
<head>
<meta name="spreadjs culture" content="ko-kr"/>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="$DEMOROOT$/ko/purejs/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css">
<script src="$DEMOROOT$/ko/purejs/node_modules/@mescius/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script>
<script src="$DEMOROOT$/ko/purejs/node_modules/@mescius/spread-sheets-resources-ko/dist/gc.spread.sheets.resources.ko.min.js" type="text/javascript"></script>
<script src="$DEMOROOT$/spread/source/js/license.js" type="text/javascript"></script>
<script src="app.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div class="sample-tutorial">
<div id="ss" class="sample-spreadsheets"></div>
<div class="options-container">
<div class="option-row">
<label>Table's columns B:F have data validation rules. Column F also has conditional formatting rules. </label>
<label>Click in cell F11 (value ‘13’) and press the Tab key. A new row will be added. </label>
<label><b>You can follow the rules in the above rows to see this in action. </b></label>
<label>For example, in B12, type ‘5’. This is not a valid value so it will be highlighted. </label>
<label>Type ‘10’ in F12 to highlight is using the conditional formatting rules.</label>
</div>
</div>
</div>
</div></body>
</html>
.sample-tutorial {
position: relative;
height: 100%;
overflow: hidden;
}
.sample-spreadsheets {
width: calc(100% - 280px);
height: 100%;
overflow: hidden;
float: left;
}
.options-container {
float: right;
width: 280px;
padding: 12px;
height: 100%;
box-sizing: border-box;
background: #fbfbfb;
overflow: auto;
}
.option-row {
font-size: 14px;
padding: 5px;
margin-top: 10px;
}
label {
display: block;
margin-bottom: 6px;
}
body {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}