다음 샘플은 채우기 없음 설정을 보여줍니다.
다음 샘플은 단색 채우기 설정을 보여줍니다.
선형 그라데이션과 방사형 그라데이션을 지원합니다.
선형 그라데이션을 사용하면 각도 또는 방향 필드를 사용하여 그라데이션을 지정할 수 있습니다. 하지만 방향과 각도를 동시에 설정하면 방향이 적용됩니다.
다음 샘플은 그라데이션 채우기 설정을 보여줍니다.
다음 샘플은 그림 채우기 설정을 보여줍니다.
현재 base64 형식 그림만 지원합니다.
다음 샘플은 질감 채우기 설정을 보여줍니다.
window.onload = function() {
window.workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
window.sheet = workbook.getActiveSheet();
window.shapes = sheet.shapes;
var defaultSrc = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAABrrFhUAAAC5VBMVEUAAACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCv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BwtB/SGKU4GF5FdD6hswX6SCuvVE24YNupfw9bpmyC9SQa3adTgVWEX+OrVrCfIb40H1GjU5FVhD/pq/VBfRb5QHVavZsSXy1ofVqoroNw2BU7mKBTzg6K9S2TFvvkwFFSpWymYI2PxKFSuYI3/kVFB2cPlsTAVM/vLlypolf+RUUKpMxFRgnvxlSkUkv3kIipcomS084OgvWaK4afMzTwVFihYzyYMI0V+saBER/dmSCgYU0kIdm9e9utAAC8xnHsB/CohUYJr8Bf7D5LdhOabLSJL8/fvlMrn12VZGEsWePnw5z6blAPS8k5gHpos9vXpaYr4oI40zWkYijv4eXOyxbnEZaay5MhKb322sLPZYlQo6dhrNqcAI+Ud36mhd9Ist8aSBMhKTHzucFFufjRD4bdoGzAOO/rZtfFvNF2WkExkB8oCjP+NEK4vJL1JB8+FeQOqYda83vLnd5Jep4KVmMacCSf5mL9lPfllG+mIop4K4yT/0C1nsSQgePPBaGqeCuMif9toDIvoTBoIfG2S1jCSKPQ1+FOYnVCrIPTUrZSRR7JmaW5I/wVLBsUdjKSMx+fc9ekySP/F4MG9DdGUkUezZME9Gf2Ly4MOPM98Sxdb38YcJHP2ijLTqbNQ84Og/u8pJbPNFGenMzqggYPN3npHFnoRPBV+HykiIFNH80Gvsg78W5E+KVHBXJmUkJj/OuitZyC/LSNddG4EHHP3XXlc8eaJf8uDbSbKM9Jdiz6Rvky36RRmpsEatBQ2ItEa9URZ7kjAVHLkbSf35gRCi0P/j3UeSk/yyjPTwz/zOkCJ+YEQTEea7ThZ7kpYHuVbnOaT+FAEqb57VuZI6+kUZCVJSc1yTM02hSrv2mhypKfyj2bD+B0JWDE5gxeP8AAAAAElFTkSuQmCC";
var fillProp = el("#fillProp");
var tip = el("#tip");
// gradient fill el
var gradientFillTypeEl = el(".type");
var gradientAngleEL = el(".angle");
var gradientLinearDirectionEl = el(".linearDirection");
var gradientRadialDirectionEl = el(".radialDirection");
var gradientColorStopsEl = el(".stops");
var setGradientFillBtn = el("#shapeGradientFill .setBtn");
// picture or texture fill el
var pictureFillPropEl = el("#pictureFillOption");
var textureFillPropEl = el("#textureFillOption");
var imgInputEl = el(".imgInput");
var transparencyEl = el("#pictureOrTextureFill .transparency");
var tilePictureAsTextureEl = el(".tilePictureAsTexture");
var offsetLeftEl = el(".offsetLeft");
var offsetRightEl = el(".offsetRight");
var offsetTopEl = el(".offsetTop");
var offsetBottomEl = el(".offsetBottom");
var offsetXEl = el(".offsetX");
var offsetYEl = el(".offsetY");
var scaleXEl = el(".scaleX");
var scaleYEl = el(".scaleY");
var alignmentEl = el(".alignment");
var mirrorTypeEl = el(".mirrorType");
var setPictureOrTextureFillBtn = el("#pictureOrTextureFill .setBtn");
function addDefaultShape() {
var x = 30, y = 30, width = 200, height = 100, xGap = 260, yGap = 160;
for (var i = 0; i < 9; i++) {
var tx = x + xGap * (i % 3);
var ty = y + yGap * Math.floor(i / 3);
shapes.add("shape" + (i + 1), GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, tx, ty, width, height);
}
setFill(shapes.get('shape1'), {
type: GC.Spread.Sheets.Shapes.GradientFillType.linear,
direction: GC.Spread.Sheets.Shapes.LinearGradientFillDirection.linearRight,
stops: [
{ color: '#f7a711', position: 0},
{ color: '#f7a711', position: 0.25},
{ color: '#f6c65e', position: 0.25},
{ color: '#f6c65e', position: 0.50},
{ color: '#f8e29c', position: 0.50},
{ color: '#f8e29c', position: 0.75},
{ color: '#fffada', position: 0.75},
{ color: '#fffada', position: 1},
]
});
setFill(shapes.get('shape2'), {
type: GC.Spread.Sheets.Shapes.GradientFillType.linear,
direction: GC.Spread.Sheets.Shapes.LinearGradientFillDirection.linearDown,
stops: [
{ color: '#f7a711', position: 0},
{ color: '#ffffff', position: 1},
]
});
setFill(shapes.get('shape3'), {
type: GC.Spread.Sheets.Shapes.GradientFillType.linear,
direction: GC.Spread.Sheets.Shapes.LinearGradientFillDirection.topLeftToBottomRight,
stops: [
{ color: '#82bc00', position: 0},
{ color: '#ffffff', position: 1},
]
});
setFill(shapes.get('shape4'), {
type: GC.Spread.Sheets.Shapes.GradientFillType.radial,
direction: GC.Spread.Sheets.Shapes.RadialGradientFillDirection.fromCenter,
stops: [
{ color: '#f7a711', position: 0},
{ color: '#f7a711', position: 0.25},
{ color: '#f6c65e', position: 0.25},
{ color: '#f6c65e', position: 0.50},
{ color: '#f8e29c', position: 0.50},
{ color: '#f8e29c', position: 0.75},
{ color: '#fffada', position: 0.75},
{ color: '#fffada', position: 1},
]
});
setFill(shapes.get('shape5'), {
type: GC.Spread.Sheets.Shapes.GradientFillType.radial,
direction: GC.Spread.Sheets.Shapes.RadialGradientFillDirection.fromCenter,
stops: [
{ color: '#82bc00', position: 0},
{ color: '#ffffff', position: 1},
]
});
setFill(shapes.get('shape6'), {
type: GC.Spread.Sheets.Shapes.GradientFillType.radial,
direction: GC.Spread.Sheets.Shapes.RadialGradientFillDirection.fromBottomLeft,
stops: [
{ color: '#f7a711', position: 0},
{ color: '#ffffff', position: 1},
]
});
loadImage("$DEMOROOT$/spread/source/images/logo.jpg", function(src) {
setFill(shapes.get('shape7'), {src: src});
});
loadImage("$DEMOROOT$/spread/source/images/splogo.png", function(src) {
setFill(shapes.get('shape8'), {src: src});
});
loadImage("$DEMOROOT$/spread/source/images/splogo.png", function(src) {
setFill(shapes.get('shape9'), {src: src, tilePictureAsTexture: true, scaleX: 0.25, scaleY: 0.25});
});
}
function loadImage(url, callback) {
try {
var xhr = new XMLHttpRequest();
xhr.onload = function() {
var blob = xhr.response;
var fileReader = new FileReader();
fileReader.onload = function() {
callback(fileReader.result);
};
fileReader.readAsDataURL(blob);
};
xhr.responseType = "blob";
xhr.open("GET", url);
xhr.send();
} catch (error) {
callback(defaultSrc);
}
}
function el(str) {
return document.querySelector(str);
}
function setFill(shape, fill) {
var style = shape.style();
style.fill = fill;
shape.style(style);
}
function getSelectedShape() {
var selectedShape = null;
var allShapes = shapes.all();
for (var i = 0; i < allShapes.length; i++) {
var shape = allShapes[i];
if (shape.isSelected()) {
selectedShape = shape;
break;
}
}
return selectedShape;
}
function getGradientDirection () {
var direction = gradientLinearDirectionEl.value;
if (gradientLinearDirectionEl.style.display === 'none') {
direction = gradientRadialDirectionEl.value;
}
return direction === "undefined" ? undefined : Number(direction);
}
function showShapeProp () {
fillProp.style.display = '';
tip.style.display = 'none';
}
function hiddenShapeProp() {
fillProp.style.display = 'none';
tip.style.display = '';
}
function bindPanelEvent() {
sheet.bind(GC.Spread.Sheets.Events.ShapeSelectionChanged, function () {
var selectedShape = sheet.shapes.all().filter(function(sp){
return sp.isSelected() && sp instanceof GC.Spread.Sheets.Shapes.Shape;
});
if (selectedShape.length === 1) {
showShapeProp();
} else {
hiddenShapeProp();
}
});
gradientFillTypeEl.onchange = function() {
var type = gradientFillTypeEl.value;
if (Number(type) === GC.Spread.Sheets.Shapes.GradientFillType.linear) {
gradientLinearDirectionEl.style.display = '';
gradientRadialDirectionEl.style.display = 'none';
} else {
gradientLinearDirectionEl.style.display = 'none';
gradientRadialDirectionEl.style.display = '';
}
};
tilePictureAsTextureEl.onchange = function() {
var v = tilePictureAsTextureEl.checked;
pictureFillPropEl.style.display = v ? "none" : "";
textureFillPropEl.style.display = v ? "" : "none";
}
setGradientFillBtn.onclick = function() {
setFill(getSelectedShape(), {
type: Number(gradientFillTypeEl.value),
direction: getGradientDirection(),
angle: Number(gradientAngleEL.value),
stops: JSON.parse(gradientColorStopsEl.value)
})
};
setPictureOrTextureFillBtn.onclick = function() {
var blob = imgInputEl.files[0];
var fileReader = new FileReader();
fileReader.addEventListener('load', function() {
setFill(getSelectedShape(), {
src: fileReader.result,
transparency: transparencyEl.value,
tilePictureAsTexture: tilePictureAsTextureEl.checked,
offsetLeft: offsetLeftEl.value,
offsetRight: offsetRightEl.value,
offsetTop: offsetTopEl.value,
offsetBottom: offsetBottomEl.value,
offsetX: offsetXEl.value,
offsetY: offsetYEl.value,
scaleX: scaleXEl.value,
scaleY: scaleYEl.value,
alignment: alignmentEl.value,
mirrorType: mirrorTypeEl.value,
});
});
fileReader.readAsDataURL(blob);
};
}
function start() {
addDefaultShape();
bindPanelEvent();
gradientColorStopsEl.value = JSON.stringify([
{ position: 0, color:"#82BC00" },
{ position:0.5, color:"white" },
{ position:1, color:"orange" }
], null, 2);
}
start();
}
<!doctype html>
<html style="height:100%;font-size:14px;">
<head>
<meta name="spreadjs culture" content="ko-kr"/>
<meta charset="utf-8" />
<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$/ko/purejs/node_modules/@mescius/spread-sheets-resources-ko/dist/gc.spread.sheets.resources.ko.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 id="fillProp" class="options-container" style="display: none;">
<div id="shapeGradientFill" class="option-row">
<label class="title">Gradient Fill</label>
<label>Graient Fill Type: </label>
<select class='type'>
<option value="0">linear</option>
<option value="1">radial</option>
</select>
<label>Direction: </label>
<select class='linearDirection'>
<option value="undefined">none</option>
<option value="0">linearRight</option>
<option value="45">topLeftToBottomRight</option>
<option value="90">linearDown</option>
<option value="135">topRightToBottomLeft</option>
<option value="180">linearLeft</option>
<option value="225">bottomRightToTopLeft</option>
<option value="270">linearUp</option>
<option value="315">bottomLeftToTopRight</option>
</select>
<select class='radialDirection' style="display: none;">
<option value="0">fromCenter</option>
<option value="1">fromTopLeft</option>
<option value="2">fromTopRight</option>
<option value="3">fromBottomLeft</option>
<option value="4">fromBottomRight</option>
</select>
<label>Angle: </label>
<input class='angle' type="number" value="0"/>
<label>Color Stops: </label>
<textarea class='stops' rows="10"></textarea>
<button class='setBtn'>Set Gradient Fill</button>
</div>
<div class="divide-line"></div>
<div id="pictureOrTextureFill" class="option-row">
<label class="title">Picture Or Texture Fill</label>
<label>Image:</label>
<input class="imgInput" type="file" accept="image/*">
<br>
<label>transparency:</label>
<input class="transparency" type="number" min="0" max="1" step="0.01" value="0">
<br>
tilePictureAsTexture:
<input class="tilePictureAsTexture" type="checkbox">
<div class="divide-line"></div>
<div id="pictureFillOption">
<label>offsetLeft:</label>
<input class="offsetLeft" type="number" min="-1" max="1" step="0.01" value="0">
<br>
<label>offsetRight:</label>
<input class="offsetRight" type="number" min="-1" max="1" step="0.01" value="0">
<br>
<label>offsetTop:</label>
<input class="offsetTop" type="number" min="-1" max="1" step="0.01" value="0">
<br>
<label>offsetBottom:</label>
<input class="offsetBottom" type="number" min="-1" max="1" step="0.01" value="0">
</div>
<div id='textureFillOption' style="display: none;">
<label>offsetX:</label>
<input class="offsetX" type="number" step="1" value="0">
<br>
<label>offsetY:</label>
<input class="offsetY" type="number" step="1" value="0">
<br>
<label>scaleX:</label>
<input class="scaleX" type="number" min="0" max="1" step="0.01" value="1">
<br>
<label>scaleY:</label>
<input class="scaleY" type="number" min="0" max="1" step="0.01" value="1">
<br>
<label>alignment:</label>
<select class="alignment">
<option value="0">Top Left</option>
<option value="1">Top </option>
<option value="2">Top Right</option>
<option value="3">Left</option>
<option value="4">Center</option>
<option value="5">Right</option>
<option value="6">Bottom Left</option>
<option value="7">Bottom</option>
<option value="8">Bottom Right</option>
</select>
<br>
<label>mirrorType:</label>
<select class="mirrorType">
<option value="0">None</option>
<option value="1">Horizontal</option>
<option value="2">Vertical</option>
<option value="3">Both</option>
</select>
</div>
<div class="divide-line"></div>
<button class='setBtn'>Set Picture Or Texture Fill</button>
</div>
</div>
<div id="tip" class="options-container">
Try selecting a shape to apply a fill effect.
</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-left: 5px;
}
.divide-line {
width: 100%;
height: 1px;
background: #cbcbcb;
margin-top: 10px;
margin-bottom: 3px;
}
.title {
text-align: center;
font-weight: bold;
}
label {
display: block;
margin-top: 15px;
margin-bottom: 5px;
}
p {
padding: 2px 10px;
background-color: #F4F8EB;
}
input {
margin-left: 10px;
display: inline;
}
input[type=button] {
width: 50px;
margin-left: 1px;
}
select {
width: 160px;
margin-left: 10px;
display: inline;
}
textarea {
width: 210px;
margin: 0px 0px;
margin-left: 10px;
padding: 2px;
}
body {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.setBtn {
width: 220px;
height: 31px;
margin: 12px 10px;
}