도형 선

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

도형 선 종류를 변경할 수 있으며, 겹선 종류를 사용할 수 있습니다.
<template> <div class="sample-tutorial"> <gc-spread-sheets class="sample-spreadsheets" @workbookInitialized="initSpread"> </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" :value="compoundType" @change="updateCompoundType($event)"> <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> </template> <script setup> import GC from "@mescius/spread-sheets"; import { ref, createApp } from "vue"; import "@mescius/spread-sheets-vue"; import '@mescius/spread-sheets-shapes'; import '@mescius/spread-sheets-resources-ko'; GC.Spread.Common.CultureManager.culture("ko-kr"); let spreadRef; let compoundType = ref("0"); const initSpread = (spread) => { spreadRef = 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, function () { sheet.shapes.all().forEach(function (sp) { if (sp.isSelected() && sp instanceof GC.Spread.Sheets.Shapes.Shape) { compoundType.value = sp.style().line.compoundType; } }); }); } const setCompoundType = (spread, value) => { let activeSheet = 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); } } } const updateCompoundType = (e) => { switch (e.target.value) { case '0': setCompoundType(spreadRef, GC.Spread.Sheets.Shapes.CompoundType.simple); return; case '1': setCompoundType(spreadRef, GC.Spread.Sheets.Shapes.CompoundType.double); return; case '2': setCompoundType(spreadRef, GC.Spread.Sheets.Shapes.CompoundType.thickThin); return; case '3': setCompoundType(spreadRef, GC.Spread.Sheets.Shapes.CompoundType.thinThick); return; case '4': setCompoundType(spreadRef, GC.Spread.Sheets.Shapes.CompoundType.triple); return; default: return; } } </script> <style scoped> .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-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; } #app { height: 100%; } </style>
<!DOCTYPE html> <html style="height:100%;font-size:14px;"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>SpreadJS VUE</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/ko/vue3/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/spread/source/data/inventory-tracker.js" type="text/javascript"></script> <script src="$DEMOROOT$/ko/vue3/node_modules/systemjs/dist/system.src.js"></script> <script src="./systemjs.config.js"></script> <script src="./compiler.js" type="module"></script> <script> var System = SystemJS; System.import("./src/app.js"); System.import('$DEMOROOT$/ko/lib/vue3/license.js'); </script> </head> <body> <div id="app"></div> </body> </html>
(function (global) { SystemJS.config({ transpiler: 'plugin-babel', babelOptions: { es2015: true }, paths: { // paths serve as alias 'npm:': 'node_modules/' }, packageConfigPaths: [ './node_modules/*/package.json', "./node_modules/@mescius/*/package.json", "./node_modules/@babel/*/package.json", "./node_modules/@vue/*/package.json" ], map: { 'vue': "npm:vue/dist/vue.esm-browser.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", '@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-shapes': 'npm:@mescius/spread-sheets-shapes/index.js', '@mescius/spread-sheets-vue': 'npm:@mescius/spread-sheets-vue/index.js' }, meta: { '*.css': { loader: 'systemjs-plugin-css' }, '*.vue': { loader: "../plugin-vue/index.js" } } }); })(this);