구문
text - (필수) 텍스트 또는 변경하려는 텍스트를 포함한 셀에 대한 참조. 텍스트에 전자 문자가 없는 경우에는 텍스트가 변경되지 않습니다.
사용법 참고 사항
이 함수는 전자 문자 기호, 문자, 가타카나를 반자 문자로 변환할 수 있습니다.
지원 대소문자
지원 항목
예시 문자
대상 문자
전자 문자
SpreadJS
SpreadJS
전자 기호
!@#$
!@#$
전자 가타카나
グループシテイ
グループシテイ
window.onload = function () {
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
initSpread(spread);
};
function initSpread (spread) {
spread.suspendPaint();
let sheet0 = spread.getSheet(0);
sheet0.name("ASC usage");
setUsage(sheet0);
let sheet1 = spread.getSheet(1);
sheet1.name("ASC table");
setASCformulaInSheet(sheet1);
spread.resumePaint();
}
function setUsage (sheet) {
setTable(sheet);
sheet.setValue(3, 2, "Furigana (pronunciation of kanji name)");
sheet.setValue(4, 2, "Address");
sheet.setValue(5, 2, "Phone number");
sheet.setValue(6, 2, "Postal code");
sheet.setValue(3, 3, "ブドウ タロウ");
sheet.setValue(4, 3, "紫山3-1-4");
sheet.setValue(5, 3, "022-777-8210");
sheet.setValue(6, 3, "981-3205");
setFormula(sheet);
}
function setTable (sheet) {
sheet.tables.add("DBCS", 2, 2, 5, 3);
sheet.setColumnWidth(2, 165);
sheet.setColumnWidth(3, 165);
sheet.setColumnWidth(4, 185);
sheet.setRowHeight(3, 50);
sheet.setRowHeight(4, 50);
sheet.setRowHeight(5, 50);
sheet.setRowHeight(6, 50);
sheet.setValue(2, 2, "Usage");
sheet.setValue(2, 3, "Example Characters");
sheet.setValue(2, 4, "Target Characters");
var style = new GC.Spread.Sheets.Style();
style.wordWrap = true;
style.hAlign = GC.Spread.Sheets.HorizontalAlign.center;
style.vAlign = GC.Spread.Sheets.VerticalAlign.center;
sheet.setStyle(3, 2, style);
sheet.setStyle(4, 2, style);
sheet.setStyle(5, 2, style);
sheet.setStyle(6, 2, style);
}
function setFormula (sheet) {
sheet.setFormula(3, 4, "=ASC(D4)");
sheet.setFormula(4, 4, "=ASC(D5)");
sheet.setFormula(5, 4, "=ASC(D6)");
sheet.setFormula(6, 4, "=ASC(D7)");
}
function setASCformulaInSheet (sheet) {
let charCode = 12449;
let rowIndexOffset = 1;
sheet.addSpan(0, 0, 1, 4);
sheet.setValue(0, 0, "Full width katakana:");
setASC(sheet, rowIndexOffset, charCode, 90); //FULL width katakana
charCode = 65281;
rowIndexOffset += 6;
sheet.addSpan(6, 0, 1, 4);
sheet.setValue(6, 0, "Full width symbol and letter:");
setASC(sheet, rowIndexOffset, charCode, 94); // FW symbol and letter
}
function setASC (sheet, rowIndexOffset, charCodeStart, count) {
let str = "", i = 0;
for (i; i < count; i++) {
str = String.fromCharCode(charCodeStart + i);
let rowIndex = Math.floor(i / 20) + rowIndexOffset;
let columnIndex = i % 20;
sheet.setFormula(rowIndex, columnIndex, `=ASC("${str}")`);
}
}
<!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" style="width:100%; height:100%;"></div>
</div>
</body>
</html>
.sample-tutorial {
position: relative;
height: 100%;
overflow: hidden;
}
body {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}