基本のシェイプ

SpreadJSでは、182種類のシェイプをあらかじめ組み込んでいます。これらのシェイプは、塗りつぶしの色、境界線、テキストなどを、Excelのようにさまざまなスタイルにカスタマイズできます。

シェイプの塗りつぶしの色、境界線(色と線の幅)、テキスト(色、フォント、サイズ、水平方向と垂直方向の配置)を設定できます。 Shape APIを使用してautoShapeを追加し、シェイプのスタイルを変更できます。
window.onload = function () { var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), {sheetCount: 7}); initSpread(spread); }; function initSpread(spread) { var shapeCategory = [ { type: ['rectangle', 'roundedRectangle', 'snip1Rectangle', 'snip2SameRectangle', 'snip2DiagRectangle', 'snipRoundRectangle', 'round1Rectangle', 'round2SameRectangle', ], desc: "Rectangles", }, { type: ['oval', 'hexagon', 'cube', 'smileyFace', 'heart', 'gear9', 'actionButtonMovie', 'funnel'], desc: "Basic Shapes", }, { type: [ 'rightArrow', 'leftArrow', 'upArrow', 'downArrow', 'leftRightArrow', 'upDownArrow', 'quadArrow', 'leftRightUpArrow', ], desc: "Block Arrows", }, { type: [ 'mathPlus', 'mathMinus', 'mathMultiply', 'mathDivide', 'mathEqual', 'mathNotEqual'], desc: "Equation Shapes", }, { type: [ 'flowchartProcess', 'flowchartAlternateProcess', 'flowchartDecision', 'flowchartData', 'flowchartPredefinedProcess', 'flowchartInternalStorage', 'flowchartDocument', 'flowchartMultidocument', ], desc: "Flowchart", }, { type: [ 'shape8pointStar', 'explosion2', 'shape4pointStar', 'shape5pointStar', 'star6Point', 'star7Point', 'shape8pointStar', 'star10Point', ], desc: "Stars and Banners", }, { type: [ 'rectangularCallout', 'roundedRectangularCallout', 'ovalCallout', 'cloudCallout', 'lineCallout2', 'lineCallout3', 'lineCallout4', 'lineCallout2AccentBar', ], desc: "Callouts", }]; spread.suspendPaint(); var sheets = spread.sheets; for (var i = 0; i < shapeCategory.length; i++) { var sheet = sheets[i]; initSheet(sheet, shapeCategory[i].desc); initShape(sheet, shapeCategory[i].type);//add shape } spread.options.tabStripRatio = 0.8; spread.resumePaint(); } function initSheet(sheet, sheetName) { sheet.name(sheetName); } function initShape(sheet, shapeType) { let left = 50, top = 50, tempX = 0, tempY = 0, tempShape = null, shapeName, row = 1, column = 1; for(let i = 0, len = shapeType.length ; i < len; i++) { shapeName = shapeType[i]; if(GC.Spread.Sheets.Shapes.AutoShapeType[shapeName]){ tempShape = sheet.shapes.add(shapeName, GC.Spread.Sheets.Shapes.AutoShapeType[shapeName], left + tempX * 180, top + tempY, 150, 150); tempX ++; sheet.setText(row,column,shapeName); column = column+3; if(tempX === 4) { tempX = 0; tempY += 200; column = 1; row = 11; } } } }
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta charset="utf-8" /> <meta name="spreadjs culture" content="ja-jp" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/ja/purejs/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/ja/purejs/node_modules/@mescius/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/ja/purejs/node_modules/@mescius/spread-sheets-shapes/dist/gc.spread.sheets.shapes.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/ja/purejs/node_modules/@mescius/spread-sheets-resources-ja/dist/gc.spread.sheets.resources.ja.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></body> </html>
.sample-tutorial { position: relative; height: 100%; overflow: hidden; } .sample-spreadsheets { width: 100%; height: 100%; overflow: hidden; float: left; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }