줄임표

SpreadJS는 시트 셀의 내용이 셀의 범위를 벗어날 때 시트 셀에 텍스트 줄임표를 표시할 수 있도록 지원합니다.

단순한 JavaScript 속성 showEllipsis가 이 동작을 제어하는데, 이는 다음 데모에서 변경할 수 있는 여러 가지 스타일 설정 중 하나입니다. 셀 스타일이 어떻게 변하는지 보려면 셀을 선택하고 오른쪽의 속성을 변경해 보십시오. 텍스트 너비가 열 너비보다 긴 경우 텍스트 줄임표를 표시하려면 오버플로우를 설정하지 마십시오. 다음과 같이 textOrientation을 사용하여 스타일을 작성하고 회전을 설정할 수 있다. 표시되지 않은 텍스트를 '…'로 대체합니다. 다음 점은 텍스트가 줄임표를 표시하는지 여부에 영향을 미친다: Indent Vertical text Alignment Padding Outline column
window.onload = function () { var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 1 }); initSpread(spread); }; function initSpread(spread) { spread.fromJSON(data); var sheet = spread.getActiveSheet(); document.getElementById('HAlign0').onclick = function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); style.hAlign = 0; sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; document.getElementById('HAlign1').onclick= function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); style.hAlign = 1; sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; document.getElementById('HAlign2').onclick = function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); style.hAlign = 2; sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; document.getElementById('VAlign0').onclick = function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); style.vAlign = 0; sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; document.getElementById('VAlign1').onclick = function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); style.vAlign = 1; sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; document.getElementById('VAlign2').onclick = function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); style.vAlign = 2; sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; document.getElementById('IndentUp').onclick = function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); if (!isNaN(parseInt(style.textIndent))) { style.textIndent = (parseInt(style.textIndent) + 1) + ""; } else if (style.textIndent === undefined) { style.textIndent = '1'; } sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; document.getElementById('IndentDwon').onclick = function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); if (!isNaN(parseInt(style.textIndent)) && parseInt(style.textIndent) > 0) { style.textIndent = (parseInt(style.textIndent) - 1) + ""; } sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; document.getElementById('Vertical').onclick = function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); style.isVerticalText = true; style.textOrientation = 0; sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; document.getElementById('Normal').onclick = function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); style.isVerticalText = undefined; style.textOrientation = undefined; sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; document.getElementById('SetPadding').onclick = function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); style.cellPadding = document.getElementById('Top').value + ' ' + document.getElementById('Right').value + ' ' +document.getElementById('Bottom').value + ' '+document.getElementById('Left').value; sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; document.getElementById('ShowEllipsis').onclick = function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); style.showEllipsis = true; sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; document.getElementById('RemoveEllipsis').onclick = function () { var style = sheet.getActualStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex()); style.showEllipsis = undefined; sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), style); }; }
<!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="$DEMOROOT$/spread/source/data/ellipsis.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 id="Text Oriention" for="textOriention">Show Ellipsis:</label> <input type="button" value="Show" id="ShowEllipsis" /> <input type="button" value="Remove" id="RemoveEllipsis" /> </div> <div class="option-row"> <label id="Text Oriention" for="textOriention">HAlign:</label> <input type="button" value="Left" id="HAlign0" /> <input type="button" value="Center" id="HAlign1" /><br> <input type="button" value="Right" id="HAlign2" /> </div> <div class="option-row"> <label id="Text Oriention" for="textOriention">VAlign:</label> <input type="button" value="Top" id="VAlign0" /> <input type="button" value="Center" id="VAlign1" /><br> <input type="button" value="Bottom" id="VAlign2" /> </div> <div class="option-row"> <label id="Text Oriention" for="textOriention">Indent:</label> <input type="button" value="Increase" id="IndentUp" /> <input type="button" value="Decrease" id="IndentDwon" /> </div> <div class="option-row"> <label id="Text Oriention" for="textOriention">Vertical Text:</label> <input type="button" value="Vertical" id="Vertical" /> <input type="button" value="Normal" id="Normal" /> </div> <div class="option-row"> <label id="Text Oriention" for="textOriention">Padding:</label> <table> <tr> <td> <label class="paddingLabel1">Top:</label><input class="paddingInput1" id="Top" type="number"/><br> </td> <td> <label class="paddingLabel1">Right:</label><input class="paddingInput1" id="Right" type="number"/><br> </td> </tr> <tr> <td> <label class="paddingLabel1">Bottom:</label><input class="paddingInput1" id="Bottom" type="number"/><br> </td> <td> <label class="paddingLabel1">Left:</label><input class="paddingInput1" id="Left" type="number"/> </td> </tr> </table> <input style="margin-left: 117px;" id="SetPadding" type="button" value="Set"/> </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; } input { width: 100px; } .option-row { font-size: 14px; padding: 5px; } label { display: block; padding-bottom: 5px; } input { padding: 4px 6px; margin-bottom: 6px; margin-right: 10px; } .paddingLabel { width: 113px; display: inline-block; text-align: center; } .paddingLabel1 { width: 50px; /* display: inline-block; */ } .paddingInput { width: 84px; } .paddingInput1 { width: 84px; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }