동적 크기

SpreadJS는 행 높이 및 열 너비를 동적 크기로 설정하여 자동으로 뷰포트 크기를 조정하고 뷰포트를 채우는 메서드를 제공합니다.

동적 크기 조정 또는 비례식 크기 조정은 열 및 행이 뷰포트를 완전히 채우는지 확인하는 데 사용됩니다. 뷰포트 크기가 변경되거나 사용자가 열 또는 행을 추가/삭제/크기 조정할 경우 별 크기 조정이 적용된 열/행은 뷰포트를 채우도록 자동으로 크기가 조정됩니다. 이러한 유형의 크기 조정을 숫자와 함께 사용하여 가중치 비율을 정의할 수 있습니다. 예를 들어, 배율 크기 조정이 “3*”로 시작하는 열은 뷰포트에 있는 표준 “*” 크기 열의 3배로 채웁니다. setRowHeight 및 setColumnWidth 메서드를 사용하여 동적 크기를 설정합니다. getRowHeight 및 getColumnWidth 메서드를 사용하여 실제 크기 및 설정 값을 가져올 수 있습니다.
window.onload = function() { var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), { sheetCount: 1 }); spread.suspendPaint(); initSpread(spread); spread.resumePaint(); }; function initSpread(spread) { var sd = dataSource; var sheet = spread.getActiveSheet(); if (sd.length > 0) { sheet.setDataSource(sd); } sheet.setColumnWidth(0, "2*"); sheet.setColumnWidth(1, 70); sheet.setColumnWidth(2, "*"); sheet.setColumnWidth(3, 110); sheet.setColumnWidth(4, 80); sheet.setColumnWidth(6, 110); }
<!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/data/data.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"> <p>The column "Film" and "Lead Studio" has been set to dynamic size. <br />Change the browser size or resize the column or hide the column to see how the dynamic size works.</p> </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; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }