语法
参数
描述
range
(必需)要修剪的范围(或数组)。
trim_rows
(可选)确定应修剪哪些行。 0 - 无。 1 - 修剪前导空行。 2 - 修剪尾随空行。 3 - 修剪前导和尾随空行(默认)。
trim_cols
(可选)确定应修剪哪些列。 0 - 无。 1 - 修剪前导空列。 2 - 修剪尾随空列。 3 - 修剪前导和尾随空列(默认)。
示例
修剪引用
修剪引用(也称为 Trim Refs)是一组简写符号,允许您在不显式使用 TRIMRANGE 函数的情况下修剪范围中的空行和空列。
修剪引用通过在传统的冒号(:)范围运算符中添加点(.)来指定您希望如何修剪范围。有三种类型的修剪引用:
修剪引用类型
语法
等效 TRIMRANGE
描述
全部修剪
A1.:.E10
=TRIMRANGE(A1:E10, 3, 3)
修剪范围中的前导和尾随空白。
修剪尾随
A1:.E10
=TRIMRANGE(A1:E10, 2, 2)
仅修剪范围中的尾随空白。
修剪前导
A1.:E10
=TRIMRANGE(A1:E10, 1, 1)
仅修剪范围中的前导空白。
<template>
<div class="sample-tutorial">
<gc-spread-sheets class="sample-spreadsheets" @workbookInitialized="initSpread">
<gc-worksheet></gc-worksheet>
</gc-spread-sheets>
</div>
</template>
<script setup>
function initSpread (spread) {
let sd = data;
if (sd.length > 0) {
if (!spread) {
return;
}
spread.suspendPaint();
spread.fromJSON(sd[0]);
spread.calculate();
spread.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;
}
body {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
</style>
<!DOCTYPE html>
<html lang="en" 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$/zh/vue3/node_modules/@grapecity-software/spread-sheets/styles/gc.spread.sheets.excel2013white.css">
<script src="$DEMOROOT$/zh/vue3/node_modules/systemjs/dist/system.src.js"></script>
<script src="./systemjs.config.js"></script>
<script src="https://cdn.grapecity.com.cn/online/resources/compiler-sfc.esm-browser.js" type="module" defer></script>
<script src="$DEMOROOT$/spread/source/data/trimrange.js" type="text/javascript"></script>
<script>
var System = SystemJS;
System.import("./src/app.js");
System.import('$DEMOROOT$/zh/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/',
'cdn:': 'https://cdn.grapecity.com.cn/SpreadJS/package-contents/18.2.1/'
},
packageConfigPaths: [
'./node_modules/*/package.json',
"./node_modules/@grapecity-software/*/package.json",
"./node_modules/@babel/*/package.json",
"./node_modules/@vue/*/package.json"
],
map: {
'@grapecity-software/spread-sheets': 'cdn:spread-sheets/index.js',
'@grapecity-software/spread-sheets-resources-zh': 'cdn:spread-sheets-resources-zh/index.js',
'@grapecity-software/spread-sheets-vue': 'cdn:spread-sheets-vue/index.js',
'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",
},
meta: {
'*.css': { loader: 'systemjs-plugin-css' },
'*.vue': { loader: "../plugin-vue/index.js" }
}
});
})(this);