@@ -13,6 +13,41 @@ namespace MiniWordTests
1313{
1414 public class IssueTests
1515 {
16+ /// <summary>
17+ /// [support array list string to generate multiple row · Issue #11 · mini-software/MiniWord]
18+ /// (https://github.com/mini-software/MiniWord/issues/11)
19+ /// </summary>
20+ [ Fact ]
21+ public void TestIssue11 ( )
22+ {
23+ {
24+ var path = PathHelper . GetTempFilePath ( ) ;
25+ var templatePath = PathHelper . GetFile ( "TestIssue11.docx" ) ;
26+ var value = new Dictionary < string , object > ( )
27+ {
28+ [ "managers" ] = new [ ] { "Jack" , "Alan" } ,
29+ [ "employees" ] = new [ ] { "Mike" , "Henry" } ,
30+ } ;
31+ MiniWord . SaveAsByTemplate ( path , templatePath , value ) ;
32+ var xml = Helpers . GetZipFileContent ( path , "word/document.xml" ) ;
33+ Assert . Contains ( "Jack" , xml ) ;
34+ }
35+ {
36+ var path = PathHelper . GetTempFilePath ( ) ;
37+ var templatePath = PathHelper . GetFile ( "TestIssue11.docx" ) ;
38+ var value = new Dictionary < string , object > ( )
39+ {
40+ [ "managers" ] = new List < string > { "Jack" , "Alan" } ,
41+ [ "employees" ] = new List < string > { "Mike" , "Henry" } ,
42+ } ;
43+ MiniWord . SaveAsByTemplate ( path , templatePath , value ) ;
44+ var xml = Helpers . GetZipFileContent ( path , "word/document.xml" ) ;
45+ Assert . Contains ( "Jack" , xml ) ;
46+ }
47+ }
48+
49+
50+
1651 /// <summary>
1752 /// [Support image · Issue #3 · mini-software/MiniWord](https://github.com/mini-software/MiniWord/issues/3)
1853 /// </summary>
@@ -23,16 +58,9 @@ public void TestIssue3()
2358 var templatePath = PathHelper . GetFile ( "TestBasicImage.docx" ) ;
2459 var value = new Dictionary < string , object > ( )
2560 {
26- [ "Name" ] = "Jack" ,
27- [ "Company_Name" ] = "MiniSofteware" ,
28- [ "CreateDate" ] = new DateTime ( 2021 , 01 , 01 ) ,
29- [ "VIP" ] = true ,
30- [ "Points" ] = 123 ,
31- [ "APP" ] = "Demo APP" ,
32- [ "Logo" ] = new MiniWordPicture ( ) { Path = PathHelper . GetFile ( "TestBasicImage.png" ) , Width = 400 , Height = 400 }
61+ [ "Logo" ] = new MiniWordPicture ( ) { Path = PathHelper . GetFile ( "DemoLogo.png" ) , Width = 180 , Height = 180 }
3362 } ;
3463 MiniWord . SaveAsByTemplate ( path , templatePath , value ) ;
35- //Console.WriteLine(path);
3664 var xml = Helpers . GetZipFileContent ( path , "word/document.xml" ) ;
3765 Assert . Contains ( "<w:drawing>" , xml ) ;
3866 }
0 commit comments