수식에 범위를 입력하면 범위 표시기가 표시됩니다. 마우스를 사용하여 범위를 클릭하고 선택할 수 있습니다.
Function 클래스를 사용하여 자신만의 함수를 추가할 수 있습니다. 예:
또한 아래와 같이 함수 설명을 가져올 수 있습니다:
css 정의를 수정하여 시트 수식 텍스트 상자와 팝업 요소에서 셀 내부를 변경할 수 있습니다.
window.onload = function () {
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), {sheetCount: 2});
initSpread(spread);
};
function initSpread(spread) {
var spreadNS = GC.Spread.Sheets;
var fbx = new spreadNS.FormulaTextBox.FormulaTextBox(document.getElementById('formulaBar'));
fbx.workbook(spread);
spread.suspendPaint();
var sheet2 = spread.sheets[1];
sheet2.setArray(0, 0, [[1, 4, 7], [2, 5, 8], [3, 6, 9]]);
var sheet = spread.sheets[0];
sheet.options.allowCellOverflow = true;
sheet.setValue(1, 2, "A helpful text box is displayed when typing any formula in a cell or the area above the sheet.");
sheet.setValue(2, 2, "For example: =sum(1,2,3)");
for (var i = 5; i < 35; i++) {
for (var j = 1; j < 15; j++) {
sheet.setValue(i, j, i * j);
}
}
// used to help show table support feature
sheet.tables.add("Table1", 4, 7, 5, 4);
for (var c = 7; c <= 10; c++) {
sheet.setColumnWidth(c, 90);
}
sheet.setFormula(3, 0, "Table1[[#Headers],[Column2]]");
// used to help show custom name support feature
sheet.addCustomName("RangeB6C9", "$B$6:$C$9", 0, 0);
sheet.addCustomName("Range2", "SUM($C$11:$D$14)", 0, 0);
sheet.setFormula(4, 0, "AVERAGE(RangeB6C9)");
// used to help show multi supported reference types
var formula = "SUM(B6:C9,E6:F9,Table1[#Data],Range2,F11:J14,D16:I17)";
sheet.setActiveCell(1, 0);
sheet.getCell(1, 0).formula(formula);
fbx.text("=" + formula);
// used to help show cross sheet reference
sheet.setFormula(5, 0, "SUM(sheet2!A1:C3)");
sheet.getRange(1, 0, 5, 1).foreColor("green");
spread.resumePaint();
}
<!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 class="demo-options">
<div class="option-row">
<div id="formulaBar" contenteditable="true" spellcheck="false" style="font-family: Calibri;border: 1px solid #808080;width:100%;box-sizing: border-box;"></div>
</div>
</div>
<div id="ss" style="width:100%; height: calc(100% - 20px)"></div>
</div>
</body>
</html>
.sample-tutorial {
position: relative;
height: 100%;
overflow: hidden;
}
body {
position: absolute;
margin: 0;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.gc-across-sheet-ftb {
z-index: -1 !important;
}
.gc-across-sheet-func-popup {
z-index: -1 !important;
}