TRIMRANGE

TRIMRANGE 函数从范围或数组的边缘开始扫描,直到找到非空白单元格(或值),然后排除那些空白的行或列。

语法 参数 描述 range (必需)要修剪的范围(或数组)。 trim_rows (可选)确定应修剪哪些行。 0 - 无。 1 - 修剪前导空行。 2 - 修剪尾随空行。 3 - 修剪前导和尾随空行(默认)。 trim_columns (可选)确定应修剪哪些列。 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) 仅修剪范围中的前导空白。
window.onload = function () { var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 1 }); initSpread(spread); }; function initSpread(spread) { var sd = data; if (sd.length > 0) { if (!spread) { return; } spread.suspendPaint(); spread.fromJSON(sd[0]); spread.calculate(); spread.resumePaint(); } }
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta charset="utf-8" /> <meta name="spreadjs culture" content="zh-cn" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/zh/purejs/node_modules/@grapecity-software/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/zh/purejs/node_modules/@grapecity-software/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/zh/purejs/node_modules/@grapecity-software/spread-sheets-shapes/dist/gc.spread.sheets.shapes.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/zh/purejs/node_modules/@grapecity-software/spread-sheets-charts/dist/gc.spread.sheets.charts.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/zh/purejs/node_modules/@grapecity-software/spread-sheets-resources-zh/dist/gc.spread.sheets.resources.zh.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/spread/source/js/license.js" type="text/javascript"></script> <script src="$DEMOROOT$/spread/source/data/trimrange.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" style="width:100%;height:100%"></div> </div> </body> </html>
.sample-tutorial { position: relative; height: 100%; overflow: hidden; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }