PROPERTY 함수의 경우 개체의 속성 값을 가져올 수 있습니다. 개체 속성은 JavaScript 규칙을 따르고 대소문자를 구분합니다. 다음과 같이 수식에 PROPERTY 함수를 사용할 수 있습니다.
=PROPERTY(dataexpression, propertypath).
data_expression: 개체 데이터를 나타냅니다. 값이 개체이거나 개체 함수의 결과인 셀 참조를 허용합니다.
property_path: 개체에서 속성 경로를 나타내고, 속성 경로 다음에는 개체 깊이가 따라옵니다.
점 연산자는 PROPERTY 함수를 간소화한 것입니다. 왼쪽 값은 개체 또는 개체에 대한 참조이고, 오른쪽 값은 속성 값으로, 잘못된 문자를 포함하고 있는 경우 따옴표로 둘러쌀 수 있습니다. 점 연산자 사용 시 Excel에서 오류가 발생할 수 있다는 점에 주의하십시오.
예를 들어 다음과 같습니다.
<template>
<div class="sample-tutorial">
<gc-spread-sheets class="sample-spreadsheets" @workbookInitialized="initSpread">
<gc-worksheet>
</gc-worksheet>
<gc-worksheet>
</gc-worksheet>
</gc-spread-sheets>
</div>
</template>
<script setup>
import '@mescius/spread-sheets-vue';
import { ref } from "vue";
import GC from '@mescius/spread-sheets';
import '@mescius/spread-sheets-resources-ko';
GC.Spread.Common.CultureManager.culture("ko-kr");
const spreadRef = ref(null);
let initSpread = function (spread) {
spreadRef.value = spread;
spread.options.allowDynamicArray = true;
spread.setSheetCount(1);
spread.suspendPaint();
spread.suspendCalcService();
initSheet1(spread.getSheet(0));
spread.resumeCalcService();
spread.resumePaint();
}
let initSheet1 = function (sheet) {
sheet.suspendPaint();
sheet.name('WebService');
sheet.setColumnWidth(0,27);
sheet.setColumnWidth(1,300);
sheet.setColumnWidth(2,168);
sheet.setColumnWidth(3,168);
sheet.setValue(0, 1, 'Enter full or partial country name');
let inputStyle = new GC.Spread.Sheets.Style();
inputStyle.backColor = "#FEF3CD";
sheet.setStyle(1,1,inputStyle);
sheet.setValue(3,1,"Name");
sheet.setValue(3,2,"Population");
sheet.setValue(3,3,"Language");
sheet.setValue(1,1,"united");
let headerStyle = new GC.Spread.Sheets.Style();
headerStyle.backColor = "rgb(222,235,246)";
headerStyle.font = "bold 11pt Calibri";
headerStyle.hAlign = 1;
let borderBottom = new GC.Spread.Sheets.LineBorder;
borderBottom.color = "black";
borderBottom.style = GC.Spread.Sheets.LineStyle.thin;
headerStyle.borderBottom = borderBottom;
sheet.setStyle(3,1,headerStyle);
sheet.setStyle(3,2,headerStyle);
sheet.setStyle(3,3,headerStyle);
for (let r = 4; r < 50; r++) {
//show the spilled objects as strings by using formatter property
sheet.setFormatter(r,1,'=IFERROR(@.name, "")');
sheet.setFormatter(r,2,'#,##0');
sheet.setFormatter(r,3,'#,##0');
}
sheet.setFormula(4,1,'=FILTERJSON(IF(LEN(B2)>3,WEBSERVICE("https://restcountries.com/v2/name/"&B2)))');
sheet.setFormula(4,2,'=B5#.population');
sheet.setFormula(4,3,'=B5#.languages.0.nativeName');
sheet.resumePaint();
}
</script>
<style scoped>
#app {
height: 100%;
}
.sample-tutorial {
position: relative;
height: 100%;
overflow: hidden;
}
.sample-spreadsheets {
width: 100%;
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: 10px;
}
#switchAutoMergeMode {
margin: 10px 0px;
}
body {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
</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$/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-vue': 'npm:@mescius/spread-sheets-vue/index.js'
},
meta: {
'*.css': { loader: 'systemjs-plugin-css' },
'*.vue': { loader: "../plugin-vue/index.js" }
}
});
})(this);