@@ -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