函数使用通配符

你可以在某些函数的搜索或者匹配的时候在比较条件中使用通配符 (?, *, ~) 。

通配符 Match ? 任意单个字符 * 任意字符 ~ 后跟 ?, *, 或者 ~ ?, *, 或者 ~ 的字符 注意: 通配符只能在匹配条件为等于 (=) 的时候使用; 它不能在其它比较条件中使用 (>,<,!=,<=,>=)。 通配符能够在以下函数的条件参数中使用: AVERAGEIF AVERAGEIFS COUNTIF COUNTIFS SUMIF SUMIFS MATCH SEARCH VLOOKUP HLOOKUP DAVERAGE DGET DMAX DMIN DPRODUCT DSTDEV DSTDEVP DSUM DVAR DVARP
<template> <div class="sample-tutorial"> <gc-spread-sheets class="sample-spreadsheets" @workbookInitialized="initSpread"> <gc-worksheet> </gc-worksheet> </gc-spread-sheets> </div> </template> <script> import Vue from "vue"; import '@grapecity-software/spread-sheets-resources-zh'; GC.Spread.Common.CultureManager.culture("zh-cn"); import '@grapecity-software/spread-sheets-vue' import GC from '@grapecity-software/spread-sheets'; import './styles.css'; let App = Vue.extend({ name: "app", methods:{ initSpread: function (spread) { this.spread = spread; var spreadNS = GC.Spread.Sheets; var sheet = spread.sheets[0]; spread.suspendPaint(); sheet.options.allowCellOverflow = true; var array = [ ["Tree", "Height", "Age", "Yield", "Profit", "Height"], ["=App?e", ">10", null, null, null, "<16"], ["=P*"], ["Tree", "Height", "Age", "Yield", "Profit"], ["Apple", 18, 20, 14, 105], ["Pear", 12, 12, 10, 96], ["Cherry", 13, 14, 9, 105], ["AppLe", 14, 15, 10, 75], ["Pear", 9, 8, 8, 76.8], ["Apple", 8, 9, 6, 45] ]; sheet.setArray(0, 0, array); sheet.setColumnWidth(0, 100); var table = sheet.tables.add("Table1", 0, 0, 3, 6, spreadNS.Tables.TableThemes.medium4); table.rowFilter().filterButtonVisible(false); table = sheet.tables.add("Table2", 4, 0, 7, 5, spreadNS.Tables.TableThemes.medium4); table.rowFilter().filterButtonVisible(false); table = sheet.tables.add("Table3", 12, 0, 5, 6, spreadNS.Tables.TableThemes.medium4); table.rowFilter().filterButtonVisible(false); sheet.addSpan(12, 1, 1, 5); sheet.setValue(12, 0, 'Formula Result'); sheet.setValue(12, 1, 'Formula with wildcard'); sheet.addSpan(13, 1, 1, 5); sheet.setValue(13, 1, '=DCOUNT(A4:E10,"Age",A1:F3)'); sheet.setFormula(13, 0, 'DCOUNT(A4:E10,"Age",A1:F3)'); sheet.addSpan(14, 1, 1, 5); sheet.setValue(14, 1, '=SEARCH("?t", B1)'); sheet.setFormula(14, 0, 'SEARCH("?t", B1)'); sheet.addSpan(15, 1, 1, 5); sheet.setValue(15, 1, '=VLOOKUP("Ch*",A5:B10,2,0)'); sheet.setFormula(15, 0, 'VLOOKUP("Ch*",A5:B10,2,0)'); sheet.addSpan(17, 1, 1, 5); sheet.setValue(17, 1, '=COUNTIF(A5:B11,"App?e")'); sheet.setFormula(17, 0, 'COUNTIF(A5:B11,"App?e")'); sheet.setValue(18, 1, '=SEARCH("=P~*",A3)'); sheet.setFormula(18, 0, 'SEARCH("=P~*",A3)'); spread.resumePaint(); } } }); new Vue({ render: h => h(App) }).$mount('#app'); </script>
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/zh/vue/node_modules/@grapecity-software/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <!-- SystemJS --> <script src="$DEMOROOT$/zh/vue/node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app.vue'); System.import('$DEMOROOT$/zh/lib/vue/license.js'); </script> </head> <body> <div id="app"></div> </body> </html>
.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; }
(function(global) { System.config({ transpiler: 'plugin-babel', babelOptions: { es2015: true }, meta: { '*.css': { loader: 'css' }, '*.vue': { loader: 'vue-loader' } }, paths: { // paths serve as alias 'npm:': 'node_modules/', 'cdn:': 'https://cdn.grapecity.com.cn/SpreadJS/package-contents/18.2.3/' }, // map tells the System loader where to look for things 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', '@grapecity/jsob-test-dependency-package/react-components': 'npm:@grapecity/jsob-test-dependency-package/react-components/index.js', 'jszip': 'npm:jszip/dist/jszip.js', 'css': 'npm:systemjs-plugin-css/css.js', 'vue': 'npm:vue/dist/vue.min.js', 'vue-loader': 'npm:systemjs-vue-browser/index.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' }, // packages tells the System loader how to load when no filename and/or no extension packages: { src: { defaultExtension: 'js' }, rxjs: { defaultExtension: 'js' }, "node_modules": { defaultExtension: 'js' } } }); })(this);