Skip to content

Commit 1cab06e

Browse files
authored
Add docs for template formulas (#622)
* add template formula example images * add template formula example to readme * add template formula example to readme
1 parent 1caf3fe commit 1cab06e

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,9 +959,27 @@ var value = new Dictionary<string, object>()
959959
};
960960
MiniExcel.SaveAsByTemplate(path, templatePath, value);
961961
```
962+
#### 10. Formulas
962963

964+
##### 1. Example
965+
Prefix your formula with `$` and use `$enumrowstart` and `$enumrowend` to mark references to the enumerable start and end rows:
963966

964-
#### 10. Other
967+
![image](docs/images/template-formulas-1.png)
968+
969+
When the template is rendered, the `$` prefix will be removed and `$enumrowstart` and `$enumrowend` will be replaced with the start and end row numbers of the enumerable:
970+
971+
![image](docs/images/template-formulas-2.png)
972+
973+
##### 2. Other Example Formulas:
974+
975+
| | |
976+
|------------|-----------------------------------------------------------------------------------------|
977+
|Sum |`$=SUM(C{{$enumrowstart}}:C{{$enumrowend}})` |
978+
|Alt. Average|`$=SUM(C{{$enumrowstart}}:C{{$enumrowend}}) / COUNT(C{{$enumrowstart}}:C{{$enumrowend}})`|
979+
|Range |`$=MAX(C{{$enumrowstart}}:C{{$enumrowend}}) - MIN(C{{$enumrowstart}}:C{{$enumrowend}})` |
980+
981+
982+
#### 11. Other
965983

966984
##### 1. Checking template parameter key
967985

docs/images/template-formulas-1.png

9.8 KB
Loading

docs/images/template-formulas-2.png

11.6 KB
Loading

0 commit comments

Comments
 (0)