Shape Line

SpreadJS supports different types of compound lines in shapes which can be used to customize their appearance. The following line types are supported: simple, double, thickThin, thinThick, and triple.

You can change shape line type to a compound type:
window.onload = function () { var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 1 }); initSpread(spread); }; function initSpread(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 sun = sheet.shapes.add('rightArrow', GC.Spread.Sheets.Shapes.AutoShapeType.rightArrow, 400, 50, 200, 100); var shapeStyle2 = sun.style(); shapeStyle2.fill.color = '#FFE4B3'; shapeStyle2.line.color = "black"; shapeStyle2.line.width = 10; shapeStyle2.line.compoundType = GC.Spread.Sheets.Shapes.CompoundType.double; sun.style(shapeStyle2); var cloudCallout = sheet.shapes.add('hexagon', GC.Spread.Sheets.Shapes.AutoShapeType.hexagon, 100, 200, 200, 100); var shapeStyle3 = cloudCallout.style(); shapeStyle3.fill.color = '#FFE4B3'; shapeStyle3.line.color = "black"; shapeStyle3.line.width = 10; shapeStyle3.line.compoundType = GC.Spread.Sheets.Shapes.CompoundType.thickThin; cloudCallout.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 explosion2 = sheet.shapes.add('cross', GC.Spread.Sheets.Shapes.AutoShapeType.cross, 100, 350, 200, 100); var shapeStyle5 = explosion2.style(); shapeStyle5.fill.color = '#FFE4B3'; shapeStyle5.line.color = "black"; shapeStyle5.line.width = 10; shapeStyle5.line.compoundType = GC.Spread.Sheets.Shapes.CompoundType.triple; explosion2.style(shapeStyle5); document.querySelector('#changeCompoundType').addEventListener('change', function (e) { switch (e.target.value) { case '0': setCompoundType(spread, GC.Spread.Sheets.Shapes.CompoundType.simple); return; case '1': setCompoundType(spread, GC.Spread.Sheets.Shapes.CompoundType.double); return; case '2': setCompoundType(spread, GC.Spread.Sheets.Shapes.CompoundType.thickThin); return; case '3': setCompoundType(spread, GC.Spread.Sheets.Shapes.CompoundType.thinThick); return; case '4': setCompoundType(spread, GC.Spread.Sheets.Shapes.CompoundType.triple); return; default: return; } }); sheet.bind(GC.Spread.Sheets.Events.ShapeSelectionChanged, function () { sheet.shapes.all().forEach(function (sp) { if (sp.isSelected() && sp instanceof GC.Spread.Sheets.Shapes.Shape) { document.querySelector('#changeCompoundType').value = sp.style().line.compoundType; } }); }); } function 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); } } }
<!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$/en/purejs/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets-shapes/dist/gc.spread.sheets.shapes.min.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"> 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"> <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> </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; 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; }