아웃라인 열

SpreadJS는 워크시트 수준에서 개요 열을 지원합니다. outlineColumn 속성을 사용하여 트리 보기에서 계층 데이터를 표시합니다.

설명
app.vue
index.html
styles.css

sheet.outlineColumn.options({columnIndex: index}) 속성을 사용하여 데이터를 트리 보기로 표시합니다. 그룹 표시기를 클릭하면 열을 확장하거나 축소할 수 있습니다.

    var spread = GC.Spread.Sheets.findControl(document.getElementById('ss'));
    var sheet = spread.getActiveSheet();
    sheet.getCell(0, 0).value('Preface').textIndent(0);
    sheet.getCell(1, 0).value('Java SE5 and SE6').textIndent(1);
    sheet.getCell(2, 0).value('Java SE6').textIndent(2);
    sheet.outlineColumn.options({columnIndex:0});

기본 제공 increaseCellIndentdecreaseCellIndent 명령을 사용하여 계층 데이터를 변경합니다.

  • Increase Cell Indent Command: 셀 들여쓰기 및 행 그룹 수준을 늘리려면 키보드 바로 가기 'ctrl-atl-]'를 사용합니다.
  • Decrease Cell Indent Command: 셀 들여쓰기 및 행 그룹 수준을 줄이려면 키보드 바로 가기 'ctrl-atl-['를 사용합니다. expandIndicator 또는 collapseIndicator 옵션을 사용하여 확장 및 축소 표시기를 사용자 정의합니다.

표시기를 확장 및 축소하려면 expandIndicator 또는 collapseIndicator 옵션을 사용합니다.

    sheet.outlineColumn.options({columnIndex: 0, expandIndicator:'img/increaseCellIndent.png', collapseIndicator:'img/decreaseCellIndent.png'});

imagesshowImage 옵션을 사용하여 각 수준에 표시된 이미지를 사용자 정의할 수 있습니다.

    sheet.outlineColumn.options({columnIndex: 0, showImage: true, images: ['img/folder.png', './img/leaf1.png', 'img/leaf2.png']});

showCheckBox 옵션을 사용하여 각 행의 확인란 표시 여부 상태를 사용자 정의합니다. 셀의 확인란을 선택하거나 해제하면 해당 하위 확인란의 상태도 모두 영향을 받습니다.

    sheet.outlineColumn.options({columnIndex: 0, showCheckBox: true});

maxLevel 옵션을 사용하여 데이터 계층 수준을 제어할 수 있습니다. 기본 maxLevel은 10입니다.

    sheet.outlineColumn.options({columnIndex: 0, maxLevel: 2});
sheet.outlineColumn.options({columnIndex: index}) 속성을 사용하여 데이터를 트리 보기로 표시합니다. 그룹 표시기를 클릭하면 열을 확장하거나 축소할 수 있습니다. 기본 제공 increaseCellIndent 및 decreaseCellIndent 명령을 사용하여 계층 데이터를 변경합니다. Increase Cell Indent Command: 셀 들여쓰기 및 행 그룹 수준을 늘리려면 키보드 바로 가기 'ctrl-atl-]'를 사용합니다. Decrease Cell Indent Command: 셀 들여쓰기 및 행 그룹 수준을 줄이려면 키보드 바로 가기 'ctrl-atl-['를 사용합니다. expandIndicator 또는 collapseIndicator 옵션을 사용하여 확장 및 축소 표시기를 사용자 정의합니다. 표시기를 확장 및 축소하려면 expandIndicator 또는 collapseIndicator 옵션을 사용합니다. images 및 showImage 옵션을 사용하여 각 수준에 표시된 이미지를 사용자 정의할 수 있습니다. showCheckBox 옵션을 사용하여 각 행의 확인란 표시 여부 상태를 사용자 정의합니다. 셀의 확인란을 선택하거나 해제하면 해당 하위 확인란의 상태도 모두 영향을 받습니다. maxLevel 옵션을 사용하여 데이터 계층 수준을 제어할 수 있습니다. 기본 maxLevel은 10입니다.
<template> <div class="sample-tutorial"> <gc-spread-sheets class="sample-spreadsheets" @workbookInitialized="initSpread"> <gc-worksheet> </gc-worksheet> </gc-spread-sheets> <div class="options-container"> <div class="options-row"> <label>OutlineColumn Options:</label> </div> <div class="options-row"> <input type="checkbox" id="showIndicator" v-model="showIndicator"> <label for="showIndicator" class="inlineLabel">Show Indicator</label> </div> <div class="options-row"> <input type="checkbox" id="showCheckBox" v-model="showCheckBox"> <label for="showIndicator"class="inlineLabel">Show CheckBox</label> </div> <div class="options-row"> <input type="checkbox" id="showImage" v-model="showImage"> <label for="showIndicator"class="inlineLabel">Show Image</label> </div> <div class="options-row"> <input type="checkbox" id="allowCustomIndicator" v-model="allowCustomIndicator"> <label for="showIndicator"class="inlineLabel">Allow Custom Indicator</label> </div> <div class="options-row"> <label for="maxLevel">Max Level:</label> <input type="text" id="maxLevel" v-model="maxLevel"> </div> <div class="options-row"> <input type="button" value="Set" @click="setMaxLevel()"/> </div> <div class="options-row"> <label>Custom Image Settings:</label> </div> <div class="options-row"> <label for="image1">Label 1 image:</label> <input type="file" @change="selectImage1" id="image1"> </div> <div class="options-row"> <label for="image2">Label 2 image:</label> <input type="file" @change="selectImage2" id="image2"> </div> <div class="options-row"> <label for="image3">Label 3 image:</label> <input type="file" @change="selectImage3" id="image3"> </div> <div class="options-row"> <input type="button" value="Set" @click="setImages()"> </div> <div class="options-row"> <label>Custom Indicator Image Settings:</label> </div> <div class="options-row"> <label for="indicator1">Expanded Image:</label> <input type="file" @change="selectIndicator1" id="indicator1" :disabled="!allowCustomIndicator"> </div> <div class="options-row"> <label for="indicator2">Collapsed Image:</label> <input type="file" @change="selectIndicator2" id="indicator2" :disabled="!allowCustomIndicator"> </div> <div class="options-row"> <input type="button" value="Set" @click="setCustomIndicator()" :disabled="!allowCustomIndicator"> </div> </div> </div> </template> <script> import Vue from "vue"; import GC from '@mescius/spread-sheets'; import '@mescius/spread-sheets-resources-ko'; import '@mescius/spread-sheets-vue' GC.Spread.Common.CultureManager.culture("ko-kr"); import './styles.css'; let spreadNS = GC.Spread.Sheets; let App = Vue.extend({ name: "app", data: function () { return { spread: null, showIndicator: true, showCheckBox: true, showImage: true, allowCustomIndicator: true, maxLevel: 2, image1: "/spreadjs/demos/spread/source/images/task-1.png", image2: "/spreadjs/demos/spread/source/images/task-2.png", image3: "/spreadjs/demos/spread/source/images/task-3.png", indicator1: "/spreadjs/demos/spread/source/images/increaseIndicator.png", indicator2: "/spreadjs/demos/spread/source/images/decreaseIndicator.png" }; }, watch: { showIndicator: function (value) { let spread = this.spread; let sheet = spread.getActiveSheet(); sheet.outlineColumn.options().showIndicator = value; sheet.outlineColumn.refresh(); }, showCheckBox: function (value) { let spread = this.spread; let sheet = spread.getActiveSheet(); sheet.outlineColumn.options().showCheckBox = value; sheet.outlineColumn.refresh(); }, showImage: function (value) { let spread = this.spread; let sheet = spread.getActiveSheet(); sheet.outlineColumn.options().showImage = value; sheet.outlineColumn.refresh(); }, allowCustomIndicator: function (value) { let spread = this.spread; let sheet = spread.getActiveSheet(); if (!value) { sheet.outlineColumn.options().expandIndicator = null; sheet.outlineColumn.options().collapseIndicator = null; sheet.outlineColumn.refresh(); }else{ sheet.outlineColumn.options().expandIndicator = this.indicator1; sheet.outlineColumn.options().collapseIndicator = this.indicator2; sheet.outlineColumn.refresh(); } } }, methods: { initSpread: function (spread) { this.spread = spread; let sheet = spread.getActiveSheet(); sheet.suspendPaint(); loadData(sheet); initOutlineColumn(sheet); setOutlineColumnOptions(sheet); sheet.getRange(0,3,25,3).hAlign(GC.Spread.Sheets.HorizontalAlign.center); sheet.resumePaint(); }, setCustomIndicator(){ let spread = this.spread; let sheet = spread.getActiveSheet(); sheet.outlineColumn.options().expandIndicator = this.indicator1; sheet.outlineColumn.options().collapseIndicator = this.indicator2; sheet.outlineColumn.refresh(); }, setMaxLevel() { let spread = this.spread; let sheet = spread.getActiveSheet(); sheet.outlineColumn.options().maxLevel = parseInt(this.maxLevel); sheet.outlineColumn.refresh(); }, setImages() { let spread = this.spread; let sheet = spread.getActiveSheet(); sheet.outlineColumn.options().images = [ this.image1, this.image2, this.image3 ]; sheet.outlineColumn.refresh(); }, selectImage1(e) { let file = e.target.files[0]; if (!/image\/\w+/.test(file.type)) { alert('The file must be an image!'); return false; } let self = this; let reader = new FileReader(); reader.readAsDataURL(file); reader.onload = function (e) { self.image1 = this.result; }; }, selectImage2(e) { let file = e.target.files[0]; if (!/image\/\w+/.test(file.type)) { alert('The file must be an image!'); return false; } let self = this; let reader = new FileReader(); reader.readAsDataURL(file); reader.onload = function (e) { self.image2 = this.result; }; }, selectImage3(e) { let file = e.target.files[0]; if (!/image\/\w+/.test(file.type)) { alert('The file must be an image!'); return false; } let self = this; let reader = new FileReader(); reader.readAsDataURL(file); reader.onload = function (e) { self.image3 = this.result; }; }, selectIndicator1(e) { let file = e.target.files[0]; if (!/image\/\w+/.test(file.type)) { alert('The file must be an image!'); return false; } let self = this; let reader = new FileReader(); reader.readAsDataURL(file); reader.onload = function (e) { self.indicator1 = this.result; }; }, selectIndicator2(e) { let file = e.target.files[0]; if (!/image\/\w+/.test(file.type)) { alert('The file must be an image!'); return false; } let self = this; let reader = new FileReader(); reader.readAsDataURL(file); reader.onload = function (e) { self.indicator2 = this.result; }; }, } }); function loadData (sheet) { let sd = data; sheet.setDataSource(sd); sheet.setColumnCount(6); sheet.setColumnWidth(0, 150); sheet.setColumnWidth(1, 350); sheet.setColumnWidth(2, 150); sheet.setColumnWidth(3, 150); sheet.setColumnWidth(4, 150); sheet.setColumnWidth(5, 150); for (var r = 0; r < sd.length; r++) { var level = sd[r].level; if(level==0) { sheet.getRange(r,0,1,7).backColor("#CCCCCC"); } else if(level==1) { sheet.getRange(r,0,1,7).backColor("#EEEEEE"); } sheet.getCell(r, 0).textIndent(level); } } function initOutlineColumn (sheet) { sheet.outlineColumn.options({ columnIndex: 0, showImage: true, showCheckBox: true, images: ['$DEMOROOT$/spread/source/images/task-1.png', '$DEMOROOT$/spread/source/images/task-2.png', '$DEMOROOT$/spread/source/images/task-3.png'], expandIndicator: '$DEMOROOT$/spread/source/images/increaseIndicator.png', collapseIndicator: '$DEMOROOT$/spread/source/images/decreaseIndicator.png', maxLevel: 2 }); sheet.showRowOutline(false); sheet.outlineColumn.refresh(); } function setOutlineColumnOptions (sheet) { let options = sheet.outlineColumn.options(); } new Vue({render: h => h(App)}).$mount('#app'); </script>
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/ko/vue/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/spread/source/data/outlineColumn-wbs.js" type="text/javascript"></script> <!-- SystemJS --> <script src="$DEMOROOT$/ko/vue/node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app.vue'); System.import('$DEMOROOT$/ko/lib/vue/license.js'); </script> </head> <body> <div id="app"></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; } .options-row { font-size: 14px; padding: 5px; margin-top: 10px; } input { display: inline-block; } input[type="text"] { width: 200px; } input[type="button"] { padding: 4px 6px; width: 100%; margin-bottom: 10px; } label { display: inline-block; font-size: 13px; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; } .desc { padding: 2px 10px; background-color: #F4F8EB; }
(function (global) { System.config({ transpiler: 'plugin-babel', babelOptions: { es2015: true }, meta: { '*.css': { loader: 'css' }, '*.vue': { loader: 'vue-loader' } }, paths: { // paths serve as alias 'npm:': 'node_modules/' }, // map tells the System loader where to look for things map: { '@mescius/spread-sheets': 'npm:@mescius/spread-sheets/index.js', '@mescius/spread-sheets-resources-ko': 'npm:@mescius/spread-sheets-resources-ko/index.js', '@mescius/spread-sheets-vue': 'npm:@mescius/spread-sheets-vue/index.js', '@grapecity/jsob-test-dependency-package/react-components': 'npm:@grapecity/jsob-test-dependency-package/react-components/index.js', 'jszip': 'npm:jszip/dist/jszip.js', 'css': 'npm:systemjs-plugin-css/css.js', 'vue': 'npm:vue/dist/vue.min.js', 'vue-loader': 'npm:systemjs-vue-browser/index.js', 'tiny-emitter': 'npm:tiny-emitter/index.js', 'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js', 'systemjs-babel-build':'npm:systemjs-plugin-babel/systemjs-babel-browser.js' }, // packages tells the System loader how to load when no filename and/or no extension packages: { src: { defaultExtension: 'js' }, rxjs: { defaultExtension: 'js' }, "node_modules": { defaultExtension: 'js' } } }); })(this);