Add docs for template formulas (#622)

* add template formula example images

* add template formula example to readme

* add template formula example to readme
This commit is contained in:
meld-cp 2024-07-07 17:01:16 +12:00 committed by GitHub
parent 1caf3fee3b
commit 1cab06e464
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 1 deletions

View File

@ -959,9 +959,27 @@ var value = new Dictionary<string, object>()
};
MiniExcel.SaveAsByTemplate(path, templatePath, value);
```
#### 10. Formulas
##### 1. Example
Prefix your formula with `$` and use `$enumrowstart` and `$enumrowend` to mark references to the enumerable start and end rows:
![image](docs/images/template-formulas-1.png)
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:
![image](docs/images/template-formulas-2.png)
##### 2. Other Example Formulas:
| | |
|------------|-----------------------------------------------------------------------------------------|
|Sum |`$=SUM(C{{$enumrowstart}}:C{{$enumrowend}})` |
|Alt. Average|`$=SUM(C{{$enumrowstart}}:C{{$enumrowend}}) / COUNT(C{{$enumrowstart}}:C{{$enumrowend}})`|
|Range |`$=MAX(C{{$enumrowstart}}:C{{$enumrowend}}) - MIN(C{{$enumrowstart}}:C{{$enumrowend}})` |
#### 10. Other
#### 11. Other
##### 1. Checking template parameter key

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB