도형 선

SpreadJS에서는 도형의 모양을 사용자 정의하는 데 사용할 수 있는 여러 가지 겹선 종류를 지원합니다. 지원되는 선 종류는 단순형, 이중, 굵고 얇음, 얇고 굵음, 삼중입니다.

도형 선 종류를 변경할 수 있으며, 겹선 종류를 사용할 수 있습니다.
import { Component, NgModule, enableProdMode } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { SpreadSheetsModule } from '@mescius/spread-sheets-angular'; import GC from '@mescius/spread-sheets'; import "@mescius/spread-sheets-shapes"; import '@mescius/spread-sheets-resources-ko'; GC.Spread.Common.CultureManager.culture("ko-kr"); import './styles.css'; @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { spread: GC.Spread.Sheets.Workbook; hostStyle = { width: 'calc(100% - 280px)', height: '100%', overflow: 'hidden', float: 'left' }; compoundType = GC.Spread.Sheets.Shapes.CompoundType.simple; initSpread($event: any) { let spread = $event.spread, self = this; self.spread = spread; let sheet = spread.getActiveSheet(); var rectangle = sheet.shapes.add('rectangle', GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, 100, 50, 200, 100); var shapeStyle1 = rectangle.style(); shapeStyle1.fill.color = '#FFE4B3'; shapeStyle1.line.color = "black"; shapeStyle1.line.width = 10; shapeStyle1.line.compoundType = GC.Spread.Sheets.Shapes.CompoundType.simple; rectangle.style(shapeStyle1); var rightArrow = sheet.shapes.add('rightArrow', GC.Spread.Sheets.Shapes.AutoShapeType.rightArrow, 400, 50, 200, 100); var shapeStyle2 = rightArrow.style(); shapeStyle2.fill.color = '#FFE4B3'; shapeStyle2.line.color = "black"; shapeStyle2.line.width = 10; shapeStyle2.line.compoundType = GC.Spread.Sheets.Shapes.CompoundType.double; rightArrow.style(shapeStyle2); var hexagon = sheet.shapes.add('hexagon', GC.Spread.Sheets.Shapes.AutoShapeType.hexagon, 100, 200, 200, 100); var shapeStyle3 = hexagon.style(); shapeStyle3.fill.color = '#FFE4B3'; shapeStyle3.line.color = "black"; shapeStyle3.line.width = 10; shapeStyle3.line.compoundType = GC.Spread.Sheets.Shapes.CompoundType.thickThin; hexagon.style(shapeStyle3); var mathMultiply = sheet.shapes.add('mathMultiply', GC.Spread.Sheets.Shapes.AutoShapeType.mathMultiply, 400, 200, 200, 100); var shapeStyle4 = mathMultiply.style(); shapeStyle4.fill.color = '#FFE4B3'; shapeStyle4.line.color = "black"; shapeStyle4.line.width = 10; shapeStyle4.line.compoundType = GC.Spread.Sheets.Shapes.CompoundType.thinThick; mathMultiply.style(shapeStyle4); var cross = sheet.shapes.add('cross', GC.Spread.Sheets.Shapes.AutoShapeType.cross, 100, 350, 200, 100); var shapeStyle5 = cross.style(); shapeStyle5.fill.color = '#FFE4B3'; shapeStyle5.line.color = "black"; shapeStyle5.line.width = 10; shapeStyle5.line.compoundType = GC.Spread.Sheets.Shapes.CompoundType.triple; cross.style(shapeStyle5); sheet.bind(GC.Spread.Sheets.Events.ShapeSelectionChanged, () => { sheet.shapes.all().forEach((sp: any) => { if (sp.isSelected() && sp instanceof GC.Spread.Sheets.Shapes.Shape) { this.compoundType = sp.style().line.compoundType; } }); }); } changeCompoundType(e: any): void { switch (e.target.value) { case '0': this.setCompoundType(GC.Spread.Sheets.Shapes.CompoundType.simple); return; case '1': this.setCompoundType(GC.Spread.Sheets.Shapes.CompoundType.double); return; case '2': this.setCompoundType(GC.Spread.Sheets.Shapes.CompoundType.thickThin); return; case '3': this.setCompoundType(GC.Spread.Sheets.Shapes.CompoundType.thinThick); return; case '4': this.setCompoundType(GC.Spread.Sheets.Shapes.CompoundType.triple); return; default: return; } } setCompoundType(value: GC.Spread.Sheets.Shapes.CompoundType): void { let activeSheet = this.spread.getActiveSheet(); let shapes = activeSheet.shapes.all(); for (let i = 0; i < shapes.length; i++) { let shape = shapes[i]; if (shape.isSelected()) { var shapeStyle = shape.style(); shapeStyle.line.compoundType = value; shape.style(shapeStyle); } } } } @NgModule({ imports: [BrowserModule, SpreadSheetsModule], 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"> <!-- 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 class="sample-spreadsheets" [hostStyle]="hostStyle" (workbookInitialized)="initSpread($event)"> </gc-spread-sheets> <div class="options-container"> <div class="option-row"> Select a shape then change the line format to see the effect: </div> <hr /> <div class="option-row"> <label>Change Shapes line, use different compound type</label> <select id="changeCompoundType" (change)="changeCompoundType($event)" [value]="compoundType"> <option value="0" selected>Simple</option> <option value="1">Double</option> <option value="2">Thick Thin</option> <option value="3">Thin Thick</option> <option value="4">Triple</option> </select> <br /> </div> </div> </div>
.sample-tutorial { position: relative; width: 100%; height: 100%; overflow: hidden; } .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; margin-top: 5px; } .sample-options { z-index: 1000; } label { display: block; margin-bottom: 6px; } p{ padding:2px 10px; background-color:#F4F8EB; } input { padding: 4px 6px; width: 160px; } input[type=button] { margin-top: 6px; display: block; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }
(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-shapes': 'npm:@mescius/spread-sheets-shapes/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);