Skip to content

Commit

Permalink
0.8.0 releases
Browse files Browse the repository at this point in the history
  • Loading branch information
shps951023 committed Feb 19, 2024
1 parent 57396af commit d04fc9f
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 22 deletions.
8 changes: 6 additions & 2 deletions release-note/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@

---

### 0.7.1
- [New] Add support to if statement inside foreach statement inside templates. Please refer to samples. (via @eynarhaji)
### 0.8.0

- [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)
Expand Down
7 changes: 7 additions & 0 deletions release-note/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@

---

### 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)
Expand Down
7 changes: 7 additions & 0 deletions release-note/README.zh-Hant.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@

---

### 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)
Expand Down
Binary file added samples/docx/TestIssue47.docx
Binary file not shown.
7 changes: 4 additions & 3 deletions src/MiniWord/MiniWord.Implment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ private static void Generate(this OpenXmlElement xmlElement, WordprocessingDocum
ReplaceStatements(newTr, tags: dic);

ReplaceText(newTr, docx, tags: dic);
//Fix #47 表格应插入到模板标签位置而不是最后一行\
//Fix #47 The table should be inserted at the template tag position instead of the last row
if (table.Contains(tr))
{
table.InsertBefore(newTr, tr);
}
else {
//如果是嵌套表,暂时按原来的方案追加到末尾
else
{
// If it is a nested table, temporarily append it to the end according to the original plan.
table.Append(newTr);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/MiniWord/MiniWord.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netstandard2.0;</TargetFrameworks>
<Version>0.7.1</Version>
<Version>0.8.0</Version>
</PropertyGroup>
<PropertyGroup>
<AssemblyName>MiniWord</AssemblyName>
Expand All @@ -10,9 +10,9 @@
<PackageTags>word;template;micro-helper;mini;openxml;helper;</PackageTags>
<Description>.NET Word(docx) exporting template engine without COM+ and interop (support Linux and Mac)
</Description>
<Authors>LIN,WEI-HAN, eynarhaji</Authors>
<Authors>mini-software, Wei Lin, eynarhaji</Authors>
<PackageId>MiniWord</PackageId>
<Copyright>LIN,WEI-HAN, 2022 onwards</Copyright>
<Copyright>mini-software, Wei Lin, 2022 onwards</Copyright>
<NeutralLanguage>en</NeutralLanguage>
<license>https://raw.githubusercontent.com/mini-software/MiniWord/main/LICENSE</license>
<RootNamespace>MiniSoftware</RootNamespace>
Expand Down
76 changes: 62 additions & 14 deletions tests/MiniWordTests/IssueTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,46 @@ namespace MiniWordTests
{
public class IssueTests
{
[Fact]
public void TestIssue69()
{
{
var path = PathHelper.GetTempFilePath();
var templatePath = PathHelper.GetFile("TestIssue47.docx");
var value = new Dictionary<string, object>()
{
{ "line",new List<Dictionary<string, object>>
{
new Dictionary<string, object>
{
{"num", "1"},
{"spc", "Specification1"},
{"desc", "Description1"},
{"qty", "10"},
{"up", "20.00"},
{"tax_rate", "0.20"},
{"tax_amount", "4.00"}
},
new Dictionary<string, object>
{
{"num", "2"},
{"spc", "Specification2"},
{"desc", "Description2"},
{"qty", "5"},
{"up", "30.00"},
{"tax_rate", "0.15"},
{"tax_amount", "2.25"}
}
}
}
};
MiniWord.SaveAsByTemplate(path, templatePath, value);
// TODO: waiting solution
//var xml = Helpers.GetZipFileContent(path, "word/document.xml");
//Assert.Contains(@"MiniWord", xml);
}
}

[Fact]
public void TestIssueAvoidSplitTag()
{
Expand Down Expand Up @@ -149,7 +189,7 @@ public void TestIssue18()
new User (){ name="Jack",department="HR"},
new User (){ name="Loan",department="IT"},
},
employees = new List<User>()
employees = new List<User>()
{
new User (){ name="Jack",department="HR"},
new User (){ name="Loan",department="HR"},
Expand Down Expand Up @@ -193,7 +233,7 @@ public void TestIssue17_new()
{
var path = PathHelper.GetTempFilePath();
var templatePath = PathHelper.GetFile("TestIssue17.docx");
var value = new
var value = new
{
Content = "Test",
Content2 = "Test2",
Expand Down Expand Up @@ -250,7 +290,7 @@ public void TestIssue13_new()
{
var path = PathHelper.GetTempFilePath();
var templatePath = PathHelper.GetFile("TestExpenseDemo.docx");
var value = new
var value = new
{
TripHs = new List<Dictionary<string, object>>
{
Expand Down Expand Up @@ -343,7 +383,7 @@ public void TestIssue12()
[Fact]
public void TestIssue12_dynamic()
{

var path = PathHelper.GetTempFilePath();
var templatePath = PathHelper.GetFile("TestBasicFill.docx");
dynamic value = new ExpandoObject();
Expand All @@ -353,7 +393,7 @@ public void TestIssue12_dynamic()
value.VIP = true;
value.Points = 123;
value.APP = "Demo APP\n";

MiniWord.SaveAsByTemplate(path, templatePath, value);
var xml = Helpers.GetZipFileContent(path, "word/document.xml");
Assert.Contains(@"<w:t>MiniSofteware", xml);
Expand All @@ -369,7 +409,8 @@ public void TestIssue12_new()

var path = PathHelper.GetTempFilePath();
var templatePath = PathHelper.GetFile("TestBasicFill.docx");
object value = new {
object value = new
{
Company_Name = "MiniSofteware\n",
Name = "Jack",
CreateDate = new DateTime(2021, 01, 01),
Expand Down Expand Up @@ -434,7 +475,7 @@ Lorem Ipsum has been the industry's standard dummy text
[Fact]
public void TestIssueDemo03_dynamic()
{

var path = PathHelper.GetTempFilePath();
var templatePath = PathHelper.GetFile("TestDemo02.docx");
dynamic value = new ExpandoObject();
Expand Down Expand Up @@ -571,7 +612,8 @@ public void TestIssue5()
var templatePath = PathHelper.GetFile("TestBasicFill.docx");
var value = new Dictionary<string, object>()
{
["Name"] = new MiniWordHyperLink(){
["Name"] = new MiniWordHyperLink()
{
Url = "https://google.com",
Text = "測試連結!!"
},
Expand Down Expand Up @@ -669,7 +711,7 @@ public void MiniWordHyperLink_AnonymousArray()
var templatePath = PathHelper.GetFile("TestBasicFill.docx");
var value = new Dictionary<string, object>()
{
["Name"] = new []{
["Name"] = new[]{
new MiniWordHyperLink(){
Url = "https://google.com",
Text = "測試連結22!!"
Expand Down Expand Up @@ -706,9 +748,10 @@ public void TestIssue5_new()
{
var path = PathHelper.GetTempFilePath();
var templatePath = PathHelper.GetFile("TestBasicFill.docx");
var value = new
var value = new
{
Name =new MiniWordHyperLink(){
Name = new MiniWordHyperLink()
{
Url = "https://google.com",
Text = "測試連結!!"
},
Expand Down Expand Up @@ -755,7 +798,7 @@ public void TestIssue4_new()
{
var path = PathHelper.GetTempFilePath();
var templatePath = PathHelper.GetFile("TestBasicFill.docx");
var value = new
var value = new
{
Company_Name = "MiniSofteware",
Name = "Jack",
Expand All @@ -775,8 +818,13 @@ public void TestColor()
{
Company_Name = new MiniWordColorText { Text = "MiniSofteware", FontColor = "#eb70AB" },
Name = new MiniWordColorText { Text = "Jack", HighlightColor = "#eb70AB" },
CreateDate = new MiniWordColorText { Text = new DateTime(2021, 01, 01).ToString()
, HighlightColor = "#eb70AB", FontColor = "#ffffff" },
CreateDate = new MiniWordColorText
{
Text = new DateTime(2021, 01, 01).ToString()
,
HighlightColor = "#eb70AB",
FontColor = "#ffffff"
},
VIP = true,
Points = 123,
APP = "Demo APP",
Expand Down

0 comments on commit d04fc9f

Please sign in to comment.