아웃라인 열

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

설명
app.component.ts
index.html
app.component.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입니다.
import { Component, NgModule, enableProdMode } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import GC from '@mescius/spread-sheets'; import '@mescius/spread-sheets-resources-ko'; import { SpreadSheetsModule } from '@mescius/spread-sheets-angular'; GC.Spread.Common.CultureManager.culture("ko-kr"); import './styles.css'; const spreadNS = GC.Spread.Sheets, SheetArea = spreadNS.SheetArea; 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); } } const defaultImages = ['$DEMOROOT$/spread/source/images/task-1.png', '$DEMOROOT$/spread/source/images/task-2.png', '$DEMOROOT$/spread/source/images/task-3.png']; const defaultExpandIndicator = '$DEMOROOT$/spread/source/images/increaseIndicator.png'; const defaultCollapseIndicator = '$DEMOROOT$/spread/source/images/decreaseIndicator.png'; function initOutlineColumn (sheet) { sheet.outlineColumn.options({ columnIndex: 0, showImage: true, showCheckBox: true, images: defaultImages, expandIndicator: defaultExpandIndicator, collapseIndicator: defaultCollapseIndicator, maxLevel: 2 }); sheet.showRowOutline(false); sheet.outlineColumn.refresh(); } function setOutlineColumnOptions (sheet) { let options = sheet.outlineColumn.options(); } @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { image1 = defaultImages[0]; image2 = defaultImages[1]; image3 = defaultImages[2]; indicator1 = defaultExpandIndicator; indicator2 = defaultCollapseIndicator; spread: GC.Spread.Sheets.Workbook; hostStyle = { width: 'calc(100% - 280px)', height: '100%', overflow: 'hidden', float: 'left' }; constructor () { this.maxLevel = "2"; this.allowCustomIndicator = true; } initSpread ($event: any) { let spread = this.spread = $event.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(); } showIndicator($event) { let spread = this.spread; let sheet = spread.getActiveSheet(); sheet.outlineColumn.options().showIndicator = $event.target.checked; sheet.outlineColumn.refresh(); } showCheckBox($event) { let spread = this.spread; let sheet = spread.getActiveSheet(); sheet.outlineColumn.options().showCheckBox = $event.target.checked; sheet.outlineColumn.refresh(); } showImage($event) { let spread = this.spread; let sheet = spread.getActiveSheet(); sheet.outlineColumn.options().showImage = $event.target.checked; sheet.outlineColumn.refresh(); } setAllowCustomIndicator () { let spread = this.spread; let sheet = spread.getActiveSheet(); if (!this.allowCustomIndicator) { 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(); } } 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: any) { 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 = <string> this.result; }; } selectImage2(e: any) { 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 = <string> this.result; }; } selectImage3(e: any) { 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 = <string> this.result; }; } selectIndicator1(e: any) { 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 = <string> this.result; }; } selectIndicator2(e: any) { 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 = <string> this.result; }; } } @NgModule({ imports: [BrowserModule, SpreadSheetsModule, FormsModule], declarations: [AppComponent], exports: [AppComponent], bootstrap: [AppComponent] }) export class AppModule { } enableProdMode(); // Bootstrap application with hash style navigation and global services. platformBrowserDynamic().bootstrapModule(AppModule);
<!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/angular/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/spread/source/data/outlineColumn-wbs.js" type="text/javascript"></script> <!-- Polyfills --> <script src="$DEMOROOT$/ko/angular/node_modules/core-js/client/shim.min.js"></script> <script src="$DEMOROOT$/ko/angular/node_modules/zone.js/fesm2015/zone.min.js"></script> <!-- SystemJS --> <script src="$DEMOROOT$/ko/angular/node_modules/systemjs/dist/system.js"></script> <script src="systemjs.config.js"></script> <script> // workaround to load 'rxjs/operators' from the rxjs bundle System.import('rxjs').then(function (m) { System.import('@angular/compiler'); System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators)); System.import('$DEMOROOT$/ko/lib/angular/license.ts'); System.import('./src/app.component'); }); </script> </head> <body> <app-component></app-component> </body> </html>
<div class="sample-tutorial"> <gc-spread-sheets [hostStyle]="hostStyle" (workbookInitialized)="initSpread($event)"> <gc-worksheet [dataSource]="dataSource" [autoGenerateColumns]='autoGenerateColumns'> </gc-worksheet> </gc-spread-sheets> <div class="options-container"> <div class="options-row"> <label>OutlineColumn Options:</label> </div> <hr> <div class="options-row"> <input type="checkbox" id="showIndicator" checked (change)="showIndicator($event)"> <label for="showIndicator" class="inlineLabel">Show Indicator</label> </div> <div class="options-row"> <input type="checkbox" id="showCheckBox" checked (change)="showCheckBox($event)"> <label for="showCheckBox"class="inlineLabel">Show CheckBox</label> </div> <div class="options-row"> <input type="checkbox" id="showImage" checked (change)="showImage($event)"> <label for="showImage"class="inlineLabel">Show Image</label> </div> <div class="options-row"> <input type="checkbox" id="allowCustomIndicator" [checked]="allowCustomIndicator" [(ngModel)]="allowCustomIndicator" (change)="setAllowCustomIndicator()"> <label for="allowCustomIndicator"class="inlineLabel">Allow Custom Indicator</label> </div> <div class="options-row"> <label for="maxLevel">Max Level:</label> <input type="text" id="maxLevel" [(ngModel)]="maxLevel" [value]="maxLevel"> </div> <div class="options-row"> <input type="button" value="Set" (click)="setMaxLevel()"/> </div> <div class="options-row"> <label>Custom Image Settings:</label> </div> <hr> <div class="options-row"> <label for="image1">Label 1 image:</label> <input type="file" name="img1" id="image1" (change)="selectImage1($event)"/> </div> <div class="options-row"> <label for="image2">Label 2 image:</label> <input type="file" name="img2" id="image2" (change)="selectImage2($event)"/> </div> <div class="options-row"> <label for="image3">Label 3 image:</label> <input type="file" name="img3" id="image3" (change)="selectImage3($event)"/> </div> <div class="options-row"> <input type="button" value="Set" (click)="setImages()"> </div> <div class="options-row"> <label>Custom Indicator Image Settings:</label> </div> <hr> <div class="options-row"> <label for="indicator1">Expanded Image:</label> <input type="file" name="in1" id="indicator1" (change)="selectIndicator1($event)" [disabled]="!allowCustomIndicator"/> </div> <div class="options-row"> <label for="indicator2">Collapsed Image:</label> <input type="file" name="in2" id="indicator2" (change)="selectIndicator2($event)" [disabled]="!allowCustomIndicator"/> </div> <div class="options-row"> <input type="button" value="Set" (click)="setCustomIndicator()" ng-disable="allowCustomIndicator" [disabled]="!allowCustomIndicator"> </div> </div> </div>
.sample-tutorial { position: relative; height: 100%; overflow: hidden; } .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"] { padding: 4px 6px; width: 100%; margin-bottom: 10px; } input[type="button"] { padding: 4px 6px; width: 100%; margin-bottom: 10px; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; } .inlineLabel { display: inline-block; } #maxLevel { width:90px; }
(function (global) { System.config({ transpiler: 'ts', typescriptOptions: { tsconfig: true }, meta: { 'typescript': { "exports": "ts" }, '*.css': { loader: 'css' } }, paths: { // paths serve as alias 'npm:': 'node_modules/' }, // map tells the System loader where to look for things map: { 'core-js': 'npm:core-js/client/shim.min.js', 'zone': 'npm:zone.js/fesm2015/zone.min.js', 'rxjs': 'npm:rxjs/dist/bundles/rxjs.umd.min.js', '@angular/core': 'npm:@angular/core/fesm2022', '@angular/common': 'npm:@angular/common/fesm2022/common.mjs', '@angular/compiler': 'npm:@angular/compiler/fesm2022/compiler.mjs', '@angular/platform-browser': 'npm:@angular/platform-browser/fesm2022/platform-browser.mjs', '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/fesm2022/platform-browser-dynamic.mjs', '@angular/common/http': 'npm:@angular/common/fesm2022/http.mjs', '@angular/router': 'npm:@angular/router/fesm2022/router.mjs', '@angular/forms': 'npm:@angular/forms/fesm2022/forms.mjs', 'jszip': 'npm:jszip/dist/jszip.min.js', 'typescript': 'npm:typescript/lib/typescript.js', 'ts': './plugin.js', 'tslib':'npm:tslib/tslib.js', 'css': 'npm:systemjs-plugin-css/css.js', 'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js', 'systemjs-babel-build':'npm:systemjs-plugin-babel/systemjs-babel-browser.js', '@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-angular': 'npm:@mescius/spread-sheets-angular/fesm2020/mescius-spread-sheets-angular.mjs', '@grapecity/jsob-test-dependency-package/react-components': 'npm:@grapecity/jsob-test-dependency-package/react-components/index.js' }, // packages tells the System loader how to load when no filename and/or no extension packages: { src: { defaultExtension: 'ts' }, rxjs: { defaultExtension: 'js' }, "node_modules": { defaultExtension: 'js' }, "node_modules/@angular": { defaultExtension: 'mjs' }, "@mescius/spread-sheets-angular": { defaultExtension: 'mjs' }, '@angular/core': { defaultExtension: 'mjs', main: 'core.mjs' } } }); })(this);