Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
shps951023 committed Feb 22, 2024
2 parents 8be42d1 + d04fc9f commit 5f006a1
Show file tree
Hide file tree
Showing 14 changed files with 621 additions and 120 deletions.
116 changes: 116 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,122 @@ MiniWord.SaveAsByTemplate(path, templatePath, value);

![image](https://user-images.githubusercontent.com/12729184/190843663-c00baf16-21f2-4579-9d08-996a2c8c549b.png)

### 二级列表

Tag 是 `IEnumerable<MiniWordForeach>` 类别. 使用方式`{{foreach``endforeach}}`.

##### Example

```csharp
var value = new Dictionary<string, object>()
{
["TripHs"] = new List<Dictionary<string, object>>
{
new Dictionary<string, object>
{
{ "sDate", DateTime.Parse("2022-09-08 08:30:00") },
{ "eDate", DateTime.Parse("2022-09-08 15:00:00") },
{ "How", "Discussion requirement part1" },
{
"Details", new List<MiniWordForeach>()
{
new MiniWordForeach()
{
Value = new Dictionary<string, object>()
{
{"Text", "Air"},
{"Value", "Airplane"}
},
Separator = " | "
},
new MiniWordForeach()
{
Value = new Dictionary<string, object>()
{
{"Text", "Parking"},
{"Value", "Car"}
},
Separator = " / "
}
}
}
}
}
};
MiniWord.SaveAsByTemplate(path, templatePath, value);
```

##### Template

![before_foreach](https://user-images.githubusercontent.com/38832863/220123955-063c9345-3998-4fd7-982c-8d1e3b48bbf8.PNG)

##### Result

![after_foreach](https://user-images.githubusercontent.com/38832863/220123960-913a7140-2fa2-415e-bb3e-456e04167382.PNG)

### 条件判断

`@if``@endif` tags .

##### Example

```csharp
var value = new Dictionary<string, object>()
{
["Name"] = new List<MiniWordHyperLink>(){
new MiniWordHyperLink(){
Url = "https://google.com",
Text = "測試連結22!!"
},
new MiniWordHyperLink(){
Url = "https://google1.com",
Text = "測試連結11!!"
}
},
["Company_Name"] = "MiniSofteware",
["CreateDate"] = new DateTime(2021, 01, 01),
["VIP"] = true,
["Points"] = 123,
["APP"] = "Demo APP",
};
MiniWord.SaveAsByTemplate(path, templatePath, value);
```

##### Template

![before_if](https://user-images.githubusercontent.com/38832863/220125429-7dd6ce94-35c6-478e-8903-064f9cf9361a.PNG)

##### Result

![after_if](https://user-images.githubusercontent.com/38832863/220125435-72ea24b4-2412-45de-961a-ad4b2134417b.PNG)

### 多彩字体

##### 代码例子

```csharp
var value = new
{
Company_Name = new MiniWordColorText { Text = "MiniSofteware", FontColor = "#eb70AB", },
Name = new[] {
new MiniWordColorText { Text = "Ja", HighlightColor = "#eb70AB" },
new MiniWordColorText { Text = "ck", HighlightColor = "#a56abe" }
},
CreateDate = new MiniWordColorText
{
Text = new DateTime(2021, 01, 01).ToString(),
HighlightColor = "#eb70AB",
FontColor = "#ffffff",
},
VIP = true,
Points = 123,
APP = "Demo APP",
};
MiniWord.SaveAsByTemplate(path, templatePath, value);
```





## 其他
Expand Down
116 changes: 116 additions & 0 deletions README.zh-Hant.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,122 @@ MiniWord.SaveAsByTemplate(path, templatePath, value);



### 二级列表

Tag 是 `IEnumerable<MiniWordForeach>` 类别. 使用方式`{{foreach``endforeach}}`.

##### Example

```csharp
var value = new Dictionary<string, object>()
{
["TripHs"] = new List<Dictionary<string, object>>
{
new Dictionary<string, object>
{
{ "sDate", DateTime.Parse("2022-09-08 08:30:00") },
{ "eDate", DateTime.Parse("2022-09-08 15:00:00") },
{ "How", "Discussion requirement part1" },
{
"Details", new List<MiniWordForeach>()
{
new MiniWordForeach()
{
Value = new Dictionary<string, object>()
{
{"Text", "Air"},
{"Value", "Airplane"}
},
Separator = " | "
},
new MiniWordForeach()
{
Value = new Dictionary<string, object>()
{
{"Text", "Parking"},
{"Value", "Car"}
},
Separator = " / "
}
}
}
}
}
};
MiniWord.SaveAsByTemplate(path, templatePath, value);
```

##### Template

![before_foreach](https://user-images.githubusercontent.com/38832863/220123955-063c9345-3998-4fd7-982c-8d1e3b48bbf8.PNG)

##### Result

![after_foreach](https://user-images.githubusercontent.com/38832863/220123960-913a7140-2fa2-415e-bb3e-456e04167382.PNG)

### 条件判断

`@if``@endif` tags .

##### Example

```csharp
var value = new Dictionary<string, object>()
{
["Name"] = new List<MiniWordHyperLink>(){
new MiniWordHyperLink(){
Url = "https://google.com",
Text = "測試連結22!!"
},
new MiniWordHyperLink(){
Url = "https://google1.com",
Text = "測試連結11!!"
}
},
["Company_Name"] = "MiniSofteware",
["CreateDate"] = new DateTime(2021, 01, 01),
["VIP"] = true,
["Points"] = 123,
["APP"] = "Demo APP",
};
MiniWord.SaveAsByTemplate(path, templatePath, value);
```

##### Template

![before_if](https://user-images.githubusercontent.com/38832863/220125429-7dd6ce94-35c6-478e-8903-064f9cf9361a.PNG)

##### Result

![after_if](https://user-images.githubusercontent.com/38832863/220125435-72ea24b4-2412-45de-961a-ad4b2134417b.PNG)

### 多彩字體

##### 例子

```csharp
var value = new
{
Company_Name = new MiniWordColorText { Text = "MiniSofteware", FontColor = "#eb70AB", },
Name = new[] {
new MiniWordColorText { Text = "Ja", HighlightColor = "#eb70AB" },
new MiniWordColorText { Text = "ck", HighlightColor = "#a56abe" }
},
CreateDate = new MiniWordColorText
{
Text = new DateTime(2021, 01, 01).ToString(),
HighlightColor = "#eb70AB",
FontColor = "#ffffff",
},
VIP = true,
Points = 123,
APP = "Demo APP",
};
MiniWord.SaveAsByTemplate(path, templatePath, value);
```



## 其他

### POCO or dynamic 參數
Expand Down
10 changes: 9 additions & 1 deletion release-note/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@

---

### 0.8.0

### 0.6.2
- [New] Support new OpenXml to solve the problem of line wrapping to multiple lines #68 (via @ping9719)

- [New] Support if statement inside foreach statement inside templates. Please refer to samples. (via @eynarhaji)
- [New] Change tags for if statements for single paragraph if statement {{if and endif}} inside templates. Please refer to samples. (via @eynarhaji)
- [Bug] The table should be inserted at the template tag position instead of the last row #47 (via @itldg)

### 0.7.0
- [New] Add support to List inside List via `IEnumerable<MiniWordForeach>` and `{{foreach`/`endforeach}}` tags (via @eynarhaji)
- [New] Add support to @if statements inside templates (via @eynarhaji)
- [New] Support multiple color word by word (via @andy505050)

### 0.6.1
- [Bug] Fixed system does not support `IEnumerable<MiniWordHyperLink>` (#39 via @isdaniel)
Expand Down
12 changes: 12 additions & 0 deletions release-note/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@

---

### 0.8.0

- [New] 支持 new OpenXml to solve the problem of line wrapping to multiple lines #68 (via @ping9719)
- [New] 支持 to if statement inside foreach statement inside templates. Please refer to samples. (via @eynarhaji)
- [New] 变更 tags for if statements for single paragraph if statement {{if and endif}} inside templates. Please refer to samples. (via @eynarhaji)
- [Bug] The table should be inserted at the template tag position instead of the last row #47 (via @itldg)

### 0.7.0
- [New] 支持 List inside List via `IEnumerable<MiniWordForeach>` and `{{foreach`/`endforeach}}` tags (via @eynarhaji)
- [New] 支持 @if statements inside templates (via @eynarhaji)
- [New] 支持 multiple color word by word (via @andy505050)

### 0.6.1
- [Bug] 修正系统不支持 `IEnumerable<MiniWordHyperLink>` (#39 via @isdaniel)

Expand Down
12 changes: 12 additions & 0 deletions release-note/README.zh-Hant.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@

---

### 0.8.0

- [New] 支持 new OpenXml to solve the problem of line wrapping to multiple lines #68 (via @ping9719)
- [New] 支持 to if statement inside foreach statement inside templates. Please refer to samples. (via @eynarhaji)
- [New] 变更 tags for if statements for single paragraph if statement {{if and endif}} inside templates. Please refer to samples. (via @eynarhaji)
- [Bug] The table should be inserted at the template tag position instead of the last row #47 (via @itldg)

### 0.7.0
- [New] 支持 List inside List via `IEnumerable<MiniWordForeach>` and `{{foreach`/`endforeach}}` tags (via @eynarhaji)
- [New] 支持 @if statements inside templates (via @eynarhaji)
- [New] 支持 multiple color word by word (via @andy505050)

### 0.6.1
- [Bug] 修正系統不支持 `IEnumerable<MiniWordHyperLink>` (#39 via @isdaniel)

Expand Down
Binary file not shown.
Binary file modified samples/docx/TestIfStatement.docx
Binary file not shown.
Binary file added samples/docx/TestIssue47.docx
Binary file not shown.
Loading

0 comments on commit 5f006a1

Please sign in to comment.