Skip to content

Commit d04fc9f

Browse files
committed
0.8.0 releases
1 parent 57396af commit d04fc9f

File tree

7 files changed

+89
-22
lines changed

7 files changed

+89
-22
lines changed

release-note/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@
2222

2323
---
2424

25-
### 0.7.1
26-
- [New] Add support to if statement inside foreach statement inside templates. Please refer to samples. (via @eynarhaji)
25+
### 0.8.0
26+
27+
- [New] Support new OpenXml to solve the problem of line wrapping to multiple lines #68 (via @ping9719)
28+
29+
- [New] Support if statement inside foreach statement inside templates. Please refer to samples. (via @eynarhaji)
2730
- [New] Change tags for if statements for single paragraph if statement {{if and endif}} inside templates. Please refer to samples. (via @eynarhaji)
31+
- [Bug] The table should be inserted at the template tag position instead of the last row #47 (via @itldg)
2832

2933
### 0.7.0
3034
- [New] Add support to List inside List via `IEnumerable<MiniWordForeach>` and `{{foreach`/`endforeach}}` tags (via @eynarhaji)

release-note/README.zh-CN.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222

2323
---
2424

25+
### 0.8.0
26+
27+
- [New] 支持 new OpenXml to solve the problem of line wrapping to multiple lines #68 (via @ping9719)
28+
- [New] 支持 to if statement inside foreach statement inside templates. Please refer to samples. (via @eynarhaji)
29+
- [New] 变更 tags for if statements for single paragraph if statement {{if and endif}} inside templates. Please refer to samples. (via @eynarhaji)
30+
- [Bug] The table should be inserted at the template tag position instead of the last row #47 (via @itldg)
31+
2532
### 0.7.0
2633
- [New] 支持 List inside List via `IEnumerable<MiniWordForeach>` and `{{foreach`/`endforeach}}` tags (via @eynarhaji)
2734
- [New] 支持 @if statements inside templates (via @eynarhaji)

release-note/README.zh-Hant.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222

2323
---
2424

25+
### 0.8.0
26+
27+
- [New] 支持 new OpenXml to solve the problem of line wrapping to multiple lines #68 (via @ping9719)
28+
- [New] 支持 to if statement inside foreach statement inside templates. Please refer to samples. (via @eynarhaji)
29+
- [New] 变更 tags for if statements for single paragraph if statement {{if and endif}} inside templates. Please refer to samples. (via @eynarhaji)
30+
- [Bug] The table should be inserted at the template tag position instead of the last row #47 (via @itldg)
31+
2532
### 0.7.0
2633
- [New] 支持 List inside List via `IEnumerable<MiniWordForeach>` and `{{foreach`/`endforeach}}` tags (via @eynarhaji)
2734
- [New] 支持 @if statements inside templates (via @eynarhaji)

samples/docx/TestIssue47.docx

14.1 KB
Binary file not shown.

src/MiniWord/MiniWord.Implment.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,14 @@ private static void Generate(this OpenXmlElement xmlElement, WordprocessingDocum
8888
ReplaceStatements(newTr, tags: dic);
8989

9090
ReplaceText(newTr, docx, tags: dic);
91-
//Fix #47 表格应插入到模板标签位置而不是最后一行\
91+
//Fix #47 The table should be inserted at the template tag position instead of the last row
9292
if (table.Contains(tr))
9393
{
9494
table.InsertBefore(newTr, tr);
9595
}
96-
else {
97-
//如果是嵌套表,暂时按原来的方案追加到末尾
96+
else
97+
{
98+
// If it is a nested table, temporarily append it to the end according to the original plan.
9899
table.Append(newTr);
99100
}
100101
}

src/MiniWord/MiniWord.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net45;netstandard2.0;</TargetFrameworks>
4-
<Version>0.7.1</Version>
4+
<Version>0.8.0</Version>
55
</PropertyGroup>
66
<PropertyGroup>
77
<AssemblyName>MiniWord</AssemblyName>
@@ -10,9 +10,9 @@
1010
<PackageTags>word;template;micro-helper;mini;openxml;helper;</PackageTags>
1111
<Description>.NET Word(docx) exporting template engine without COM+ and interop (support Linux and Mac)
1212
</Description>
13-
<Authors>LIN,WEI-HAN, eynarhaji</Authors>
13+
<Authors>mini-software, Wei Lin, eynarhaji</Authors>
1414
<PackageId>MiniWord</PackageId>
15-
<Copyright>LIN,WEI-HAN, 2022 onwards</Copyright>
15+
<Copyright>mini-software, Wei Lin, 2022 onwards</Copyright>
1616
<NeutralLanguage>en</NeutralLanguage>
1717
<license>https://raw.githubusercontent.com/mini-software/MiniWord/main/LICENSE</license>
1818
<RootNamespace>MiniSoftware</RootNamespace>

tests/MiniWordTests/IssueTests.cs

Lines changed: 62 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,46 @@ namespace MiniWordTests
99
{
1010
public class IssueTests
1111
{
12+
[Fact]
13+
public void TestIssue69()
14+
{
15+
{
16+
var path = PathHelper.GetTempFilePath();
17+
var templatePath = PathHelper.GetFile("TestIssue47.docx");
18+
var value = new Dictionary<string, object>()
19+
{
20+
{ "line",new List<Dictionary<string, object>>
21+
{
22+
new Dictionary<string, object>
23+
{
24+
{"num", "1"},
25+
{"spc", "Specification1"},
26+
{"desc", "Description1"},
27+
{"qty", "10"},
28+
{"up", "20.00"},
29+
{"tax_rate", "0.20"},
30+
{"tax_amount", "4.00"}
31+
},
32+
new Dictionary<string, object>
33+
{
34+
{"num", "2"},
35+
{"spc", "Specification2"},
36+
{"desc", "Description2"},
37+
{"qty", "5"},
38+
{"up", "30.00"},
39+
{"tax_rate", "0.15"},
40+
{"tax_amount", "2.25"}
41+
}
42+
}
43+
}
44+
};
45+
MiniWord.SaveAsByTemplate(path, templatePath, value);
46+
// TODO: waiting solution
47+
//var xml = Helpers.GetZipFileContent(path, "word/document.xml");
48+
//Assert.Contains(@"MiniWord", xml);
49+
}
50+
}
51+
1252
[Fact]
1353
public void TestIssueAvoidSplitTag()
1454
{
@@ -149,7 +189,7 @@ public void TestIssue18()
149189
new User (){ name="Jack",department="HR"},
150190
new User (){ name="Loan",department="IT"},
151191
},
152-
employees = new List<User>()
192+
employees = new List<User>()
153193
{
154194
new User (){ name="Jack",department="HR"},
155195
new User (){ name="Loan",department="HR"},
@@ -193,7 +233,7 @@ public void TestIssue17_new()
193233
{
194234
var path = PathHelper.GetTempFilePath();
195235
var templatePath = PathHelper.GetFile("TestIssue17.docx");
196-
var value = new
236+
var value = new
197237
{
198238
Content = "Test",
199239
Content2 = "Test2",
@@ -250,7 +290,7 @@ public void TestIssue13_new()
250290
{
251291
var path = PathHelper.GetTempFilePath();
252292
var templatePath = PathHelper.GetFile("TestExpenseDemo.docx");
253-
var value = new
293+
var value = new
254294
{
255295
TripHs = new List<Dictionary<string, object>>
256296
{
@@ -343,7 +383,7 @@ public void TestIssue12()
343383
[Fact]
344384
public void TestIssue12_dynamic()
345385
{
346-
386+
347387
var path = PathHelper.GetTempFilePath();
348388
var templatePath = PathHelper.GetFile("TestBasicFill.docx");
349389
dynamic value = new ExpandoObject();
@@ -353,7 +393,7 @@ public void TestIssue12_dynamic()
353393
value.VIP = true;
354394
value.Points = 123;
355395
value.APP = "Demo APP\n";
356-
396+
357397
MiniWord.SaveAsByTemplate(path, templatePath, value);
358398
var xml = Helpers.GetZipFileContent(path, "word/document.xml");
359399
Assert.Contains(@"<w:t>MiniSofteware", xml);
@@ -369,7 +409,8 @@ public void TestIssue12_new()
369409

370410
var path = PathHelper.GetTempFilePath();
371411
var templatePath = PathHelper.GetFile("TestBasicFill.docx");
372-
object value = new {
412+
object value = new
413+
{
373414
Company_Name = "MiniSofteware\n",
374415
Name = "Jack",
375416
CreateDate = new DateTime(2021, 01, 01),
@@ -434,7 +475,7 @@ Lorem Ipsum has been the industry's standard dummy text
434475
[Fact]
435476
public void TestIssueDemo03_dynamic()
436477
{
437-
478+
438479
var path = PathHelper.GetTempFilePath();
439480
var templatePath = PathHelper.GetFile("TestDemo02.docx");
440481
dynamic value = new ExpandoObject();
@@ -571,7 +612,8 @@ public void TestIssue5()
571612
var templatePath = PathHelper.GetFile("TestBasicFill.docx");
572613
var value = new Dictionary<string, object>()
573614
{
574-
["Name"] = new MiniWordHyperLink(){
615+
["Name"] = new MiniWordHyperLink()
616+
{
575617
Url = "https://google.com",
576618
Text = "測試連結!!"
577619
},
@@ -669,7 +711,7 @@ public void MiniWordHyperLink_AnonymousArray()
669711
var templatePath = PathHelper.GetFile("TestBasicFill.docx");
670712
var value = new Dictionary<string, object>()
671713
{
672-
["Name"] = new []{
714+
["Name"] = new[]{
673715
new MiniWordHyperLink(){
674716
Url = "https://google.com",
675717
Text = "測試連結22!!"
@@ -706,9 +748,10 @@ public void TestIssue5_new()
706748
{
707749
var path = PathHelper.GetTempFilePath();
708750
var templatePath = PathHelper.GetFile("TestBasicFill.docx");
709-
var value = new
751+
var value = new
710752
{
711-
Name =new MiniWordHyperLink(){
753+
Name = new MiniWordHyperLink()
754+
{
712755
Url = "https://google.com",
713756
Text = "測試連結!!"
714757
},
@@ -755,7 +798,7 @@ public void TestIssue4_new()
755798
{
756799
var path = PathHelper.GetTempFilePath();
757800
var templatePath = PathHelper.GetFile("TestBasicFill.docx");
758-
var value = new
801+
var value = new
759802
{
760803
Company_Name = "MiniSofteware",
761804
Name = "Jack",
@@ -775,8 +818,13 @@ public void TestColor()
775818
{
776819
Company_Name = new MiniWordColorText { Text = "MiniSofteware", FontColor = "#eb70AB" },
777820
Name = new MiniWordColorText { Text = "Jack", HighlightColor = "#eb70AB" },
778-
CreateDate = new MiniWordColorText { Text = new DateTime(2021, 01, 01).ToString()
779-
, HighlightColor = "#eb70AB", FontColor = "#ffffff" },
821+
CreateDate = new MiniWordColorText
822+
{
823+
Text = new DateTime(2021, 01, 01).ToString()
824+
,
825+
HighlightColor = "#eb70AB",
826+
FontColor = "#ffffff"
827+
},
780828
VIP = true,
781829
Points = 123,
782830
APP = "Demo APP",

0 commit comments

Comments
 (0)