셰이프의 채우기 색, 테두리(색 및 선 너비), 텍스트(색, 글꼴, 크기, 가로 및 세로 맞춤)를 구성할 수 있습니다.
자동 셰이프를 추가하고 Shape API를 사용하여 셰이프 스타일을 변경할 수 있습니다.
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="ko-kr"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="$DEMOROOT$/ko/purejs/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css">
<script src="$DEMOROOT$/ko/purejs/node_modules/@mescius/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script>
<script src="$DEMOROOT$/ko/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="$DEMOROOT$/ko/purejs/node_modules/@mescius/spread-sheets-resources-ko/dist/gc.spread.sheets.resources.ko.min.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;
}